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

Herman van Drie hvandrie at outlook.com
Sat Jan 28 05:01:17 PST 2017


Hi,

Apologies if this e-mail reaches you multiple times... just subscribed properly to the mailing list.

Hope someone could help out:

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 in a custom table with a binary data column 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



More information about the wix-users mailing list