[wix-users] Deployment Tools Foundation: GetStream Method (fieldName)

Hoover, Jacob Jacob.Hoover at greenheck.com
Mon Feb 6 10:33:15 PST 2017


Not enough context...  What does your query look like? Also, try breaking apart the code a bit to find out which method is returning null.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Herman van Drie
Sent: Monday, February 06, 2017 11:01 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Deployment Tools Foundation: GetStream Method (fieldName)

Hi,

I have created a CA using WiX C# CA project.
During execution of the CA, I am attempting to read a Stream from a field #3 (binary data column) in a custom table using Record GetStream function (within Microsoft.Deployment.WindowsInstaller namespace):

RecordView.Execute();
Record myRecord = MsuRecordView.Fetch();

while (myRecord != null)

               {
MemoryStream ms = new MemoryStream();
byte[] inputBuffer = new byte[65535];
int ReadAmount;
while ((ReadAmount = myRecord.GetStream(3).Read(inputBuffer, 0, inputBuffer.Length)) > 0)         // <-- exception occurs: "Object reference not set to an instance of an object."
{
session.Log(String.Format("Reading stream...")); ms.Write(inputBuffer, 0, ReadAmount); } }

However, whatever I do... also different methods, like CopyTo (MemoryStream) don't seem to be able to obtain an instance. I receive an "object reference not set to instance of an object" upon calling the Record.GetStream(fieldname/number).
I use ExecuteQuery to obtain multiple Records, and subsequenty parse each Record.

Any help is very appreciated!

Thanks,

Herman van Drie


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list