Problems Deserializing Nested Dynamic Types with ProtoBuf-Net

I am trying to deserialize an object that is wrapped in several layers DynamicType = true using ProtoBuf-Net r668.

Using an older version of ProtoBuf-Net (v1), it will deserialize without any problems. However, with the latest version, it fails with

ProtoBuf.ProtoException: internal error; key mismatch occurred

[ProtoContract] private class A { [ProtoMember(1, DynamicType = true)] public object Body { get; set; } } [ProtoContract] private class B { [ProtoMember(1, DynamicType = true)] public object Body { get; set; } } [ProtoContract] private class C { [ProtoMember(1)] public string Name { get; set; } } [Test] public void Try_Serialize_Nested_DynamicTypes() { var obj = new A() {Body = new B() {Body = new C() {Name = "Brian"}}}; var serializer = new ProtoBufSerializer(); var results = serializer.Serialize(obj); var g = serializer.Deserialize<A>(results); } 
+4
c # protobuf-net
source share

No one has answered this question yet.

See similar questions:

8
Serial serialization / deserialization of sections Protobuf-net

or similar:

872
Deserialize JSON to a dynamic C # object?
21
How to serialize an inherited class with ProtoBuf-Net
6
protobuf-net OverwriteList in byte array
5
In Protobuf-net, is it possible to serialize undecorated classes?
2
How can I describe Any type in protobuf-net?
2
Protobuf-net r282 has problems deserializing an object serialized with r249
2
How to deserialize objects specified in .asmx web service using protobuf-net
2
Multiple object references when deserializing with ProtoBuf even when using AsReferenceDefault
one
Abstract / problems with protobuf-net array
one
Protobuf Inheritance with WCF

All Articles