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

Herman van Drie hvandrie at outlook.com
Mon Feb 6 12:10:22 PST 2017


I did already.



Tried session.database, and also from within the CA to even open the database from sourcepath as readonly, doesn’t make a difference.



Text fields in the record return correct string values. It’s the binary data field that doesn’t return anything.



The SQL query was simple: Select * from TableName.

Even tried different methods to get a Record object, it gets the string data but it’s as if it can’t acquire the data stream.



Using tue sdk wistreams vbscript I am able to see that the data streams exist in the database, it returns <table>.<primary key> value of the record for each stream. But just somehow impossible to read it from within CA. Tried different scheduling options as well as sequence order (before and after InstallInitialize)… doesn’t matter.



Greetz,



Herman





From: Hoover, Jacob<mailto:Jacob.Hoover at greenheck.com>
Sent: maandag 6 februari 2017 19:33
To: WiX Toolset Users Mailing List<mailto:wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Deployment Tools Foundation: GetStream Method (fieldName)





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/

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



More information about the wix-users mailing list