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); }
c # protobuf-net
Brumschlag
source share