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)); } }
void LoadNodeCollectionContent(AbstractNode node, Expression thisObject, DebugType iListType) { thisObject = thisObject.CastToIList(); int listCount = thisObject.GetIListCount(); PropertyInfo indexerProp = iListType.GetProperty("Item"); for (int i = 0; i < listCount; i++) { Expression itemExpr = thisObject.AppendIndexer(i); PropertyNode itemNode = new PropertyNode( new ObjectGraphProperty { Name = "[" + i + "]", MemberInfo = indexerProp, Expression = itemExpr, Value = "", IsAtomic = true, TargetNode = null }); node.AddChild(itemNode); } }