anerjan / protobuf-net

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

Silverlight Erorr On(De)Serializing with RIA entities #250

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
roos.ict.architectures@gmail.com

==============

What steps will reproduce the problem?
1. Create RIA or WFC entities
2. Add protocontract attributes and members
3. Use serialiser in silverlight to serialise the genereated Enity

What is the expected output? What do you see instead?
I expect serialised bytes

What version of the product are you using? On what operating system?
Silverlight, latest version/runnng build

Please provide any additional information below.

Client code:
 ModelCmdResult rescmd = new ModelCmdResult();//my entity
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
      rescmd.res = 10;
      rescmd.FrgnKey = Guid.NewGuid();
      ProtoBuf.Serializer.Serialize<ModelCmdResult>(ms, rescmd);
      byte[] bytes = ms.ToArray();
}

Since the class is inheriting from Entity, it has a OnSerializing and 
OnDeserilizing members.
That throws errors like "Unsupported exception on OnDeserilizing" :Invalid 
callback signature

I downloaded the sources, and it goes wrong in 
MetaType.cs, line 511 & 512.
If I slash CheckForCallback last two lines away, everything works fine.

if (memberAttribs != null && memberAttribs.Length > 0)
{
      CheckForCallback(method, memberAttribs, "ProtoBuf.ProtoBeforeSerializationAttribute", ref callbacks, 0);
                            CheckForCallback(method, memberAttribs, "ProtoBuf.ProtoAfterSerializationAttribute", ref callbacks, 1);
                            CheckForCallback(method, memberAttribs, "ProtoBuf.ProtoBeforeDeserializationAttribute", ref callbacks, 2);
                            CheckForCallback(method, memberAttribs, "ProtoBuf.ProtoAfterDeserializationAttribute", ref callbacks, 3);
                            CheckForCallback(method, memberAttribs, "System.Runtime.Serialization.OnSerializingAttribute", ref callbacks, 4);
                            CheckForCallback(method, memberAttribs, "System.Runtime.Serialization.OnSerializedAttribute", ref callbacks, 5);
                        ->goes wrong here   // CheckForCallback(method, memberAttribs, "System.Runtime.Serialization.OnDeserializingAttribute", ref callbacks, 6);
                          ->ande here // CheckForCallback(method, memberAttribs, "System.Runtime.Serialization.OnDeserializedAttribute", ref callbacks, 7);
                        } 

Original issue reported on code.google.com by roos.ict...@gmail.com on 11 Nov 2011 at 8:31

Attachments: