C
Carl Gilbert
Hi
I am trying to serialize an assembly into a byte array. I am using a
BinaryFormatter to serialize the assembly into a stream. Once in the
stream, would then save this to the database in a byte().
I have come across a few issues with deserializing the stream so I decided
to strip out all the un-necessary code and simply serialize from an assembly
to a stream and then de-serialize is back again using the same
BinaryFormatter.
However, I get the following error:
SaveGUI: Insufficient state to deserialize the object. More information
is needed.
With the following code:
Try
Dim myAssembly As [Assembly]
myAssembly = myAssembly.LoadFile("d:\test.dll")
Dim binFormatter As New Formatters.Binary.BinaryFormatter
Dim stream As New MemoryStream
binFormatter.Serialize(stream, myAssembly)
stream.Position = 0
Dim ass As [Assembly]
ass = binFormatter.Deserialize(stream)
Catch ex As System.Exception
Debug.WriteLine(ex.Message, "SaveGUI")
End Try
Any help on this would be greatly appreciated.
Regards, Carl Gilbert
I am trying to serialize an assembly into a byte array. I am using a
BinaryFormatter to serialize the assembly into a stream. Once in the
stream, would then save this to the database in a byte().
I have come across a few issues with deserializing the stream so I decided
to strip out all the un-necessary code and simply serialize from an assembly
to a stream and then de-serialize is back again using the same
BinaryFormatter.
However, I get the following error:
SaveGUI: Insufficient state to deserialize the object. More information
is needed.
With the following code:
Try
Dim myAssembly As [Assembly]
myAssembly = myAssembly.LoadFile("d:\test.dll")
Dim binFormatter As New Formatters.Binary.BinaryFormatter
Dim stream As New MemoryStream
binFormatter.Serialize(stream, myAssembly)
stream.Position = 0
Dim ass As [Assembly]
ass = binFormatter.Deserialize(stream)
Catch ex As System.Exception
Debug.WriteLine(ex.Message, "SaveGUI")
End Try
Any help on this would be greatly appreciated.
Regards, Carl Gilbert