[Mono-dev] Patch for some obscure cases in Dictionary (small)

Lionel Cuir lionel_email at aulofee.com
Tue Jun 17 12:49:57 EDT 2008


Hello gentlemen,

Since you're working on the Dictionary class, maybe you could help me 
debugging this.
I have seen recent posts and patch to make the Dictionary more binary 
compatible between Mono and .Net (ie serialized data being compatible 
for serialization on one platform and deserialization on the other).

I've done a couple of tests and what surprises me is that the binary 
form looks different in many cases but can still be deserialized by the 
other platform... in most cases only (see the example below).

=> What's the status for the Dictionary class. Are Mono and .Net 
officially binary compatible for the Dictionary or not yet?

Examples:
- Case 1: I have a Dictionary<long, DateTime>. Even if different, the 
binary serialized forms can be deserialized by the other platform (!). 
(see dico1_dotnet.bin and dico1_mono.bin).
- Case 2: I have a Dictionary<long, Triplet<long, ManagementState, 
DateTime>> where Triplet is a simple triplet struct (see below) and 
ManagementState a basic enum.
Here, neither Mono not .Net is able to deserialize a dico serialzed by 
the other (see dico2_dotnet.bin and dico2_mono.bin).

Thanks for your advice!
Lionel

Here's the Triplet struct:
[Serializable]
public struct Triplet<TX, TY, TZ>
{
    TX _X;
    TY _Y;
    TZ _Z;

    public Triplet(TX x, TY y, TZ z)
    {
        this._X = x;
        this._Y = y;
        this._Z = z;
    }

    public TX X
    {
        [DebuggerStepThrough]
        get { return _X; }
    }
    public TY Y
    {
        [DebuggerStepThrough]
        get { return _Y; }
    }
    public TZ Z
    {
        [DebuggerStepThrough]
        get { return _Z; }
    }
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dico1_mono.bin
Type: application/octet-stream
Size: 1431 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080617/0cdde68f/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dico2_dotnet.bin
Type: application/octet-stream
Size: 3718 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080617/0cdde68f/attachment-0005.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dico2_mono.bin
Type: application/octet-stream
Size: 3663 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080617/0cdde68f/attachment-0006.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dico1_dotnet.bin
Type: application/octet-stream
Size: 1431 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080617/0cdde68f/attachment-0007.bin 


More information about the Mono-devel-list mailing list