private void CheckRecursionStackAndPush(object instance) { int num; if (this.recursionStack == null) { this.recursionStack = new MutableList(); } else if (instance != null && (num = this.recursionStack.IndexOfReference(instance)) >= 0) { throw new ProtoException("Possible recursion detected (offset: " + (this.recursionStack.Count - num).ToString() + " level(s)): " + instance.ToString()); } this.recursionStack.Add(instance); }
private void CheckRecursionStackAndPush(object instance) { int hitLevel; if (recursionStack == null) { recursionStack = new MutableList(); } else if (instance != null && (hitLevel = recursionStack.IndexOfReference(instance)) >= 0) { #if DEBUG Helpers.DebugWriteLine("Stack:"); foreach(object obj in recursionStack) { Helpers.DebugWriteLine(obj == null ? "<null>" : obj.ToString()); } Helpers.DebugWriteLine(instance == null ? "<null>" : instance.ToString()); #endif throw new ProtoException("Possible recursion detected (offset: " + (recursionStack.Count - hitLevel).ToString() + " level(s)): " + instance.ToString()); } recursionStack.Add(instance); }
private void CheckRecursionStackAndPush(object instance) { if (recursionStack == null) { recursionStack = new MutableList(); } else if (instance != null && recursionStack.IndexOfReference(instance) >= 0) { throw new ProtoException("Possible recursion detected; " + instance.ToString()); } recursionStack.Add(instance); }