[Mono-dev] A significant number of Mono classes are not (binary) compatible with their .Net equivalents?
Lionel Cuir
lionel_email at aulofee.com
Thu Jan 25 06:22:09 EST 2007
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
PDG
Aulofée
tel: +33.(0)6.99.24.38.04
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 *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/6f660160/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SerializationTester.zip
Type: application/zip
Size: 4239 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/6f660160/attachment.zip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logs.zip
Type: application/zip
Size: 11673 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/6f660160/attachment-0001.zip
More information about the Mono-devel-list
mailing list