DebugWriteLine() private method

private DebugWriteLine ( string message ) : void
message string
return void
        private void CheckRecursionStackAndPush(object instance)
        {
            if (recursionStack == null)
            {
                recursionStack     = new MutableList();
                recursionStackHash = new System.Collections.Hashtable(new ReferenceEqualityComparer());
            }
            else if (instance != null && recursionStackHash.ContainsKey(instance))
            {
                int hitLevel = recursionStack.IndexOfReference(instance);
#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);
            if (instance != null)
            {
                recursionStackHash.Add(instance, instance);
            }
        }
        internal object GetKeyedObject(int key)
        {
            if (key-- == Root)
            {
                if (rootObject == null)
                {
                    throw new ProtoException("No root object assigned");
                }
                return(rootObject);
            }
            BasicList list = List;

            if (key < 0 || key >= list.Count)
            {
                Helpers.DebugWriteLine("Missing key: " + key);
                throw new ProtoException("Internal error; a missing key occurred");
            }

            object tmp = list[key];

            if (tmp == null)
            {
                throw new ProtoException("A deferred key does not have a value yet");
            }
            return(tmp);
        }
Exemplo n.º 3
0
        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);
        }