[Mono-list] Deserialization issue when talking to webservice from mono
robertj at gmx.net
Wed Feb 11 14:18:02 EST 2009
Robert Weiss wrote:
> Yes. Assuming that your example class "Sample" was part of the .net
> framework and the implementation in .Net was what you listed and the
> mono implementation differs, then the binary serialization would not
> work. Since this *appears* to be the issue at hand with the way that the
> Generic Sorted List was implemented in mono, how does one get the
> incorrect mono implementation fixed?
Mono's implementation isn't incorrect. It's just incompatible
regarding binary serialization.
Since SortedList<K, V> does not implement ISerializable, there
is no way to intercept the serialization process other than
trying to design the class layout like MS did. It's not an
easy process given that mono's developers never decompile
and look at MS' implementation.
Here's an exception I got while trying to deserialize
a stream created with MS.NET 2.x:
Unhandled Exception: System.TypeLoadException: Could not load type
mscorlib, Version=188.8.131.52, Culture=neutral,
Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
This means that MS' implementation is using an internal class
SortedList<K,V>.KeyList. No one knows exactly what this class is
for and how it's implemented...
You should replace the SortedList from your WebService API with
something that can be serialized better, like an array of pairs.
More on serialization: http://www.mono-project.com/FAQ:_Technical
(search for serialization).
More information about the Mono-list