Esempio n. 1
0
        IEnumerable <AbstractNode> GetChildNodes()
        {
            PropertyInfo countProperty = iListType.GetInterface(typeof(ICollection).FullName).GetProperty("Count");
            Expression   countExpr     = targetObject.AppendPropertyReference(countProperty);
            int          count         = 0;

            try {
                // Do not get string representation since it can be printed in hex
                Value countValue = countExpr.Evaluate(WindowsDebugger.DebuggedProcess.SelectedStackFrame);
                count = (int)countValue.PrimitiveValue;
            } catch (GetValueException) {
                count = -1;
            }
            if (count == -1)
            {
                yield return(ValueNode.Create(countExpr));

                yield break;
            }

            for (int i = 0; i < count; i++)
            {
                PropertyInfo itemProperty = iListType.GetProperty("Item");
                Expression   itemExpr     = targetObject.AppendMemberReference(itemProperty, new PrimitiveExpression(i));
                yield return(ValueNode.Create(itemExpr));
            }
        }
 IEnumerable <AbstractNode> GetChildNodes()
 {
     foreach (Expression childExpr in targetObject.AppendObjectMembers(shownType, Flags))
     {
         yield return(ValueNode.Create(childExpr));
     }
 }
        public static IEnumerable <AbstractNode> GetChildNodesOfObject(Expression targetObject, DebugType shownType)
        {
            BindingFlags Flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Field | BindingFlags.GetProperty;

            if (shownType.BaseType != null)
            {
                yield return(new BaseClassNode(targetObject, shownType.BaseType));
            }
            if (shownType.HasMembers(NonPublicInstanceMembersNode.Flags))
            {
                yield return(new NonPublicInstanceMembersNode(targetObject, shownType));
            }
            if (shownType.HasMembers(StaticMembersNode.Flags) ||
                shownType.HasMembers(NonPublicStaticMembersNode.Flags))
            {
                yield return(new StaticMembersNode(targetObject, shownType));
            }
            DebugType iListType = shownType.GetInterface(typeof(IList).FullName);

            if (iListType != null)
            {
                yield return(new IListNode(targetObject, iListType));
            }
            foreach (Expression childExpr in targetObject.AppendObjectMembers(shownType, Flags))
            {
                yield return(ValueNode.Create(childExpr));
            }
        }
 IEnumerable <AbstractNode> GetChildNodes()
 {
     if (shownType.HasMembers(NonPublicStaticMembersNode.Flags))
     {
         yield return(new NonPublicStaticMembersNode(targetObject, shownType));
     }
     foreach (Expression childExpr in targetObject.AppendObjectMembers(shownType, Flags))
     {
         yield return(ValueNode.Create(childExpr));
     }
 }
Esempio n. 5
0
 IEnumerable <AbstractNode> GetChildNodes()
 {
     foreach (Expression expr in stackFrame.MethodInfo.GetExpressionsForAllVariables())
     {
         yield return(ValueNode.Create(expr));
     }
     if (stackFrame.Thread.CurrentException != null)
     {
         yield return(ValueNode.Create(new CurrentExceptionExpression()));
     }
 }
Esempio n. 6
0
        IEnumerable <AbstractNode> GetChildren()
        {
            // The whole array is small - just add all elements as childs
            if (bounds.TotalElementCount <= MaxElementCount)
            {
                foreach (Expression childExpr in arrayTarget.AppendIndexers(bounds))
                {
                    yield return(ValueNode.Create(childExpr));
                }
                yield break;
            }

            // Find a dimension of size at least 2
            int splitDimensionIndex = bounds.Count - 1;

            for (int i = 0; i < bounds.Count; i++)
            {
                if (bounds[i].Count > 1)
                {
                    splitDimensionIndex = i;
                    break;
                }
            }
            ArrayDimension splitDim = bounds[splitDimensionIndex];

            // Split the dimension
            int elementsPerSegment = 1;

            while (splitDim.Count > elementsPerSegment * MaxElementCount)
            {
                elementsPerSegment *= MaxElementCount;
            }
            for (int i = splitDim.LowerBound; i <= splitDim.UpperBound; i += elementsPerSegment)
            {
                List <ArrayDimension> newDims = new List <ArrayDimension>(bounds);
                newDims[splitDimensionIndex] = new ArrayDimension(i, Math.Min(i + elementsPerSegment - 1, splitDim.UpperBound));
                yield return(new ArrayRangeNode(arrayTarget, new ArrayDimensions(newDims), originalBounds));
            }
            yield break;
        }