c# - Protobuf-net - Possible recursion detected (offset: 1 level(s)) -


i trying serialize below class has varb store varb = this in constructor of class basing on condition. while serializing throwing recursion detected error.

[serializable()] [protocontract(asreferencedefault = true)] public class : iserializable {     [protomember(1)]     public serializabledictionary<int, b> vara = new serializabledictionary<int, b>();     [protomember(2, asreference = true)]     protected gameobject gameobject;     [protomember(3, asreference = true)]     protected varb; }    private byte[] payloadtobytearray(object2propertiesmappinglistwrapper obj) {     if (obj == null)         return null;      using (memorystream ms = new memorystream())     {         serializer.serialize(ms, obj);         return ms.toarray();     } } 

how resolve this? should keep header [protomember] on varb in above because of same class type.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -