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
Post a Comment