[Mono-list] Deserialization issue when talking to webservicefrom mono

Alan McGovern alan.mcgovern at gmail.com
Wed Feb 11 14:34:03 EST 2009


On Wed, Feb 11, 2009 at 7:23 PM, Robert Weiss <rweiss at chesapeakebay.net>wrote:

> Ok. I understand that answer and I have implemented a change similar to
> what you responded.


That's a good move. Binary serialization isn't even compatible between
different releases of the .NET framework if you happen to try serializing
the wrong class.


> However, I was under the assumption that mono was a supported project,
> had access to the MS .NET Framework Source and was implementing it based
> on that source.


Nope, not at all.


> Is this not the case? If it is the case, then this is a bug that needs
> to be fixed to the correct implementation.

The fix is really to not use binary serialization on that datatype. As I
said above, you can end up in trouble just trying to interop with another
version of MS.NET. If i remember correctly, binary DateTime serialization is
one which changed between MS.NET releases.

Glad you got it working anyway. That's the important part ;)

Alan.



> Thanks for the info.
>
> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com
> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Robert Jordan
> Sent: Wednesday, February 11, 2009 2:18 PM
> To: Mono-list at lists.ximian.com
> Subject: Re: [Mono-list] Deserialization issue when talking to
> webservicefrom mono
>
> 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
> 'System.Collections.Generic.SortedList`2+KeyList[[System.Int32,
> mscorlib, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089],[System.String, mscorlib,
> Version=2.0.0.0, 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).
>
> Robert
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090211/ca01dbdf/attachment.html 


More information about the Mono-list mailing list