[Mono-dev] A significant number of Mono classes are not (binary) compatible with their .Net equivalents?

Lluis Sanchez lluis at ximian.com
Thu Jan 25 08:18:01 EST 2007

This topic has been discussed in this list several times. Please see the


El dj 25 de 01 del 2007 a les 12:22 +0100, en/na Lionel Cuir va
> Hello all,
> My intention is not to raise an useless debate (no 'trolling'), and I
> sincerely hope I'm misleading somewhere...
> It seems there are many many classes in Mono that are not fully
> compatible - to be more precise binary compatible - with their
> equivalents in the .Net framework (the fact you work with Mono on
> Linux or Windows does not matter). By binary compatible, I mean to
> binary serialize a class in Mono and to deserialize in .Net, or
> vice-versa. This is a simple but much needed need when two systems
> must communicate with each other (over network or with file exchange).
> To give some figures, I've created a sample test application and ran
> it on System.dll: over 430 types, approx. 68 instantiated and
> serialized with .Net throw an exception when deserialized with Mono.
> Where does the problem come from?
> Binary serialization works by creating an internal dictionary which
> stores the names of the object's serialized fields and their values.
> At deserialization, we use the names in the tables, matchs them
> against the name of the class of the framework (Mono or .Net) and
> restore the value. 
> The problem is simple but concrete: .Net and Mono developers have not
> use the same name for their fields. Hence the exceptions thrown.
> The solution (very time consuming): we should review all serializable
> classes and make their fields' names match those of the .Net
> framework.
> Once more, I sincerely hope that I'm misleading somewhere, because I
> don't think the review of all that classes is anybody's cup of tea...
> Regards,
> Lionel
> Attached files:
> --------------
> 1. The test application mentioned above. It's far from perfect (some
> exceptions thrown are due to the fact it's quickly coded) but gives a
> fair view of the problem. If you want to run the test application
> against another assembly than System.dll, just look for the line
> SerializeMostAssemblyTypesAndWriteToFiles(typeof(Guid).Assembly); and
> replace typeof(Guid).Assembly with a reference to the assembly you
> want to test. 
>     Usage:
>     "Aulofee.SerializationTester write"  to inspect an assembly,
> instantiate its exporable serializable types and serialize them into
> some files.
>     This generates a log file "log_write.txt"
>     "Aulofee.SerializationTester read"  to read all the files
> generated above an deserialize their content.
>     This generates a log file "log_read.txt"
> 2. The two logs generated when deserializing the files generated with
> the test app, one generated with .Net, the other with Mono (on Linux).
> -- 
> Lionel Cuir
> Aulofée
> tel: +33.(0)
> mail: lionel.cuir at aulofee.com
> web: http://www.aulofee.com
> Centralisez et automatisez la supervision de vos systèmes
> d'information avec Alizé:
> * sécurité/corrélation de logs * inventaire/détection de parc *
> reporting * cartographie réseau *
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list