Open GoogleCodeExporter opened 9 years ago
I seem to be experiencing the same issue. Are there any conditions where this
exception is expected? For example, could overlap of keys for a type's
ProtoMember declarations be an issue?
Original comment by jeff.a.z...@gmail.com
on 27 Aug 2012 at 1:56
This bug occured to me recently, and I could only debug it by using customized
builds of protobuf-net.
The reason: at serialization-time protobuf net assigns ids from a 'sequence' to
your dynamic types. The sequence always starts at 1, it's actually a list-index
in the NetObjectCache class. Your dyn.types receive ids in the order of
traversal (first come-first assigned). The ordering isn't fixed! Something
similar is written to the outfile:
[typeid=1, actualtype=YourOuterConcreteType]
[typeid=2, actualtype=YourInnerConcreteType]
At deserialization for some reason always my inner type came first, not the
outer container. protobuf-net detected that it's a YourInnerConcreteType of
typekey 2, and wanted to put it into NetObjectCache's list with an index of 2.
But the list was empty, the index was supposed to be 1 hence the exception.
The solution: nested dynamictypes doesn't work, or not always work, so I had to
specify the concrete type for my Outer class.
Hope this helps.
Original comment by akos.lov...@gmail.com
on 26 Sep 2013 at 2:23
Original issue reported on code.google.com by
ste...@berry.asn.au
on 20 Aug 2012 at 4:18Attachments: