public IListNode(Expression targetObject, DebugType iListType) { this.targetObject = targetObject; this.iListType = iListType; this.Name = "IList"; this.ChildNodes = GetChildNodes(); }
public NonPublicInstanceMembersNode(Expression targetObject, DebugType shownType) { this.targetObject = targetObject; this.shownType = shownType; this.Name = StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.NonPublicMembers}"); this.ChildNodes = GetChildNodes(); }
public ErrorNode(Expression targetObject, GetValueException error) { this.targetObject = targetObject; this.error = error; this.Name = targetObject.CodeTail; this.Text = error.Error; }
public ArrayIndexerExpression(Expression targetObject, Expression[] arguments) { if (targetObject == null) throw new ArgumentNullException("targetObject"); if (arguments == null) throw new ArgumentNullException("arguments"); this.targetObject = targetObject; this.arguments = arguments; this.name = GetName(); }
public MemberReferenceExpression(Expression targetObject, MemberInfo memberInfo, params Expression[] arguments) { if (memberInfo == null) throw new ArgumentNullException("memberInfo"); this.targetObject = targetObject; this.memberInfo = memberInfo; this.arguments = arguments ?? new Expression[0]; this.name = GetName(); }
/// <summary> /// Constructor used by the factory method Create() /// </summary> /// <param name="val"></param> /// <exception cref="System.Management.Automation.GetValueException"> /// Can be thrown by InvokeToString() /// </exception> public ValueNode(Value val) { this.expression = val.Expression; canSetText = false; if (val.Type.IsInteger) { canSetText = (val.Expression is LocalVariableIdentifierExpression) || (val.Expression is ParameterIdentifierExpression) || (val.Expression is ArrayIndexerExpression) || (val.Expression is MemberReferenceExpression && ((MemberReferenceExpression)val.Expression).MemberInfo is FieldInfo); } this.Image = IconService.GetBitmap("Icons.16x16." + GetImageName(val)); this.Name = val.Expression.CodeTail; if (DebuggingOptions.Instance.ShowValuesInHexadecimal && val.Type.IsInteger) { fullText = String.Format("0x{0:X}", val.PrimitiveValue); } else if (val.Type.IsPointer) { fullText = String.Format("0x{0:X}", val.PointerAddress); } else { fullText = val.AsString; } if (val.Type != null) { this.Type = val.Type.Name; } else { this.Type = String.Empty; } // Note that these return enumerators so they are lazy-evaluated this.ChildNodes = null; if (val.IsNull) { } else if (val.Type.IsClass || val.Type.IsValueType) { this.ChildNodes = Utils.GetChildNodesOfObject(this.Expression, val.Type); } else if (val.Type.IsArray) { this.ChildNodes = Utils.GetChildNodesOfArray(this.Expression, val.ArrayDimensions); } else if (val.Type.IsPointer) { Value deRef = val.Dereference(); if (deRef != null) { this.ChildNodes = new AbstractNode [] { new ValueNode(deRef) }; } } if (DebuggingOptions.Instance.ICorDebugVisualizerEnabled) { AbstractNode info = ICorDebug.GetDebugInfoRoot(val.Process, val.CorValue); this.ChildNodes = PrependNode(info, this.ChildNodes); } // Do last since it may expire the object if ((val.Type.IsClass || val.Type.IsValueType) && !val.IsNull) { fullText = val.InvokeToString(); } this.Text = (fullText.Length > 256) ? fullText.Substring(0, 256) + "..." : fullText; }
/// <summary> /// Factory method to create an instance. /// </summary> /// <param name="expression">The expression containing the value you wish to display.</param> /// <returns> /// Returns a ValueNode if it can successfully evaluate expression or /// ErrorNode if it fails to do so. /// </returns> /// <see cref=ErrorNode""/> public static AbstractNode Create(Expression expression) { try { Value val = expression.Evaluate(WindowsDebugger.DebuggedProcess); return new ValueNode(val); } catch (GetValueException e) { return new ErrorNode(expression, e); } }
public ArrayRangeNode(Expression arrayTarget, ArrayDimensions bounds, ArrayDimensions originalBounds) { this.arrayTarget = arrayTarget; this.bounds = bounds; this.originalBounds = originalBounds; this.Name = GetName(); this.ChildNodes = GetChildren(); }
public ArrayIndexerExpression(Expression targetObject, params int[] indices) { if (targetObject == null) throw new ArgumentNullException("targetObject"); if (indices == null) throw new ArgumentNullException("indices"); this.targetObject = targetObject; List<Expression> indicesAst = new List<Expression>(); foreach(int indice in indices) { indicesAst.Add(new PrimitiveExpression(indice)); } this.arguments = indicesAst.ToArray(); this.name = GetName(); }
public BaseClassNode(Expression targetObject, DebugType shownType) { this.targetObject = targetObject; this.shownType = shownType; this.Image = IconService.GetBitmap("Icons.16x16.Class"); this.Name = StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.BaseClass}"); this.Type = shownType.FullName; if (shownType.FullName == "System.Object") { this.ChildNodes = null; } else { this.ChildNodes = Utils.GetChildNodesOfObject(targetObject, shownType); } }
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); } }
public static IEnumerable<AbstractNode> GetChildNodesOfArray(Expression expression, ArrayDimensions dimensions) { if (dimensions.TotalElementCount == 0) return new AbstractNode[0]; return new ArrayRangeNode(expression, dimensions, dimensions).ChildNodes; }