riyowry / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

List<T> Deserialization with Unity (3.5) #416

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please include an e-mail address if this might need a dialogue!
==============
Hi,
I have a problem with the De-serialization of a List<Pair> in Unity 3.5.6.
Serialization is working but I have en Exception with the Deserialization:
"Attempt to access a private/protected method failed.".
The StackTrace is " at (wrapper managed-to-native) 
System.Reflection.MonoCMethod:IntervalInvoke...

The serialization and the deserialization of a Pair object are both working and 
with a List<int> it's working too.

What is missing in my Pair class ? 

Thanks, Harold (harold.peignaux(at)gmail.com)

[ProtoContract]
class Pair
{
    public Pair() { }
    public Pair(int index, int value)
    {
        this.value = value;
        this.index = index;
    }

    [ProtoMember(1, IsRequired = false)]
    public int index;
    [ProtoMember(2, IsRequired = false)]
    public int value;
}

Original issue reported on code.google.com by harold.p...@gmail.com on 19 Nov 2013 at 1:00

GoogleCodeExporter commented 8 years ago
Could you try making the class itself public? Just to see if this makes Mono 
happier?

Original comment by marc.gravell on 19 Nov 2013 at 1:58

GoogleCodeExporter commented 8 years ago
It was so simple.

Thank you.

Original comment by harold.p...@gmail.com on 19 Nov 2013 at 4:27

GoogleCodeExporter commented 8 years ago

Original comment by marc.gravell on 19 Nov 2013 at 4:29