Monday, May 07, 2012

XLANGPart.LoadFrom - "Value cannot be null. Parameter name: s as MemoryStream"

If we use a .NET library for construct an orchestration message from a Stream data, we need to use the following code:

orchestrationMessage[0].LoadFrom(someStream);

If we don't use a MemoryStream, we receive the following error:

"Value cannot be null. Parameter name: s as MemoryStream"

We need to copy our stream to a MemoryStream object and then construct the XLANGPart:


MemoryStream someMemoryStream = StreamToMemoryStream(someStream);
orchestrationMessage[0].LoadFrom(someMemoryStream );


This is because the class Microsoft.XLANGs.Core.Value, only accepts MemoryStream objects in their LoadFrom method.

No comments: