Hi,
I am serializing objects on a worker thread, but when I attempt to
deserialize on a different thread, I get the error :
An unhandled exception of type
'System.Runtime.Serialization.SerializationExcepti on' occurred in
mscorlib.dll
Additional information: End of Stream encountered before parsing was
completed.
I know why there is an error, because the data written to the file on the
second thread is different to that written to a file on the main thread. I
wrote a simple test to write out a simple object in a console application,
and this is what was written:
WPIF.Core.Scratch, Version=1.0.2205.36835,
Culture=neutral, PublicKeyToken=null *PIF.Core.Scratch.Final.Campaigner
fulfillmentEvent _visitsLeft_id
3PIF.Core.Scratch.Final.FulfillmentHandler2
However this is what is written when the same object is written on a second
worker thread:
WPIF.Core.Scratch, Version=1.0.2205.36835,
Culture=neutral, PublicKeyToken=null *PIF.Core.Scratch.Final.Campaigner
fulfillmentEvent _visitsLeft_id
"System.DelegateSerializationHolder
.
Notice the second to last line. When serializing in a simple console, the
PIF.Core.Scratch.Final.FulfillmentHandler2 type is written out, but in the
thread example, System.DelegateSerializationHolder is written out...? ??
The classes Campaigner, FulfillmentHandler2 and FulfillmentSerializer all
live in the same namespace and assembly, PIF.Core.Scratch.Final. I am
scratching my head. Having done some research I notice changes in the 1.1
framework for security mods. affect deserialization over remoting boundaries
(http://www.cs.odu.edu/~jmayor/cs477/...or_NET1_1.htm),
but I am wondering what this means for simply creating a second thread and
deserializing on it? I suspect there is something subtle here I am missing.
Any advice on this most appreciated!
J.