C
Carl Mercier
Hi!
I have 2 different applications/assembly. The first one creates an
object and serializes it to a textfile on disk.
The second one has the the exact same class (copied/pasted). It reads
the file that is on disk and attempts to deserialize it and create a new
object.
The process works fine if I serialize/deserialize in the first
application, but it fails when I try to deserialize in the second
application. Here's the exception:
Parse Error, no assembly associated with Xml key
a1:http://schemas.microsoft.com/clr/ns...9.30011, Culture=neutral, PublicKeyToken=null
AdonisConfigDisk
Although it is generally not a good idea to copy/paste code like I did
(I should have 1 dll with the code I need), I am forced to do so for
some reasons I won't go into right now.
Here's my code... Does anyone have an idea of what I'm doing wrong? How
can I strip the assembly information from the serialized object?
Public Function Serialize() As MemoryStream
Dim stream As New MemoryStream
Dim sf As New SoapFormatter(Nothing, New
StreamingContext(StreamingContextStates.All))
sf.Serialize(stream, Me)
stream.Seek(0, 0)
Return stream
End Function
Public Shared Function Deserialize(ByVal ms As MemoryStream) As
AdonisConfigDisk
Dim sf As New SoapFormatter(Nothing, New
StreamingContext(StreamingContextStates.All))
Return DirectCast(sf.Deserialize(ms), AdonisConfigDisk)
End Function
Thanks!
Carl
I have 2 different applications/assembly. The first one creates an
object and serializes it to a textfile on disk.
The second one has the the exact same class (copied/pasted). It reads
the file that is on disk and attempts to deserialize it and create a new
object.
The process works fine if I serialize/deserialize in the first
application, but it fails when I try to deserialize in the second
application. Here's the exception:
Parse Error, no assembly associated with Xml key
a1:http://schemas.microsoft.com/clr/ns...9.30011, Culture=neutral, PublicKeyToken=null
AdonisConfigDisk
Although it is generally not a good idea to copy/paste code like I did
(I should have 1 dll with the code I need), I am forced to do so for
some reasons I won't go into right now.
Here's my code... Does anyone have an idea of what I'm doing wrong? How
can I strip the assembly information from the serialized object?
Public Function Serialize() As MemoryStream
Dim stream As New MemoryStream
Dim sf As New SoapFormatter(Nothing, New
StreamingContext(StreamingContextStates.All))
sf.Serialize(stream, Me)
stream.Seek(0, 0)
Return stream
End Function
Public Shared Function Deserialize(ByVal ms As MemoryStream) As
AdonisConfigDisk
Dim sf As New SoapFormatter(Nothing, New
StreamingContext(StreamingContextStates.All))
Return DirectCast(sf.Deserialize(ms), AdonisConfigDisk)
End Function
Thanks!
Carl