[Mono-list] Binary serialization

Miguel de Icaza miguel@ximian.com
17 Jan 2003 11:10:35 -0500

Hello Lluis,

> I've just commited the implementation of BinaryFormatter and other
> support classes. Now Mono has support for binary serialization!!

Your documentation work is amazing!   The research you have done is
amazing.  I will comment later on as well.
> I've attached a document that describes the format. There are some
> gaps in some tables of codes, so if you find a meaning for the missing
> codes, please contact me and I'll update the document.

Is it possible to check the document in CVS as well?

> However, it does not mean that mono serialization is fully compatible
> with microsoft's runtime. Although the format is the same, objects may
> have a different internal structure. For example, mono's ArrayList
> stores elements in an object array named dataArray, while in MS
> runtime, it is named _items. An ArrayList serialized using mono is
> currently not deserializable with MS and vice-versa. I think it
> happens the same with many other classes, and changing all of them may
> be a lot of work.

If it is just a matter of the fields having compatible names, it might
be worth just changing the names in our implementation.  It would be
more difficult if we need more fields to be serialized though.

We should try things one at a time, and see how far we can get. 

> Another difference is how primitive types are serialized. I've noticed
> that MS uses the codes of the enum TypeCode to identify primitive
> types. I did the same, but the codes of mono's TypeCode enum are
> different, so the formatter gets confused when reading values of an
> object serialized with MS runtime. I've also seen that decimal values
> are serialized using a different format. However, this should be easy
> to solve.

This seems like a bug in our runtime.  The TypeCode enumeration should
in principle have the same values.  If it does not, that is our
mistake.  Do you know which values are wrong?  (Or all of it?)

> Now, I'll try to plug this into Remoting ;-)

Excellent work Lluis, excellent.