public virtual ValueReference GetChild(ObjectPath vpath, EvaluationOptions options) { if (vpath.Length == 0) { return(this); } ValueReference val = GetChild(vpath[0], options); if (val != null) { return(val.GetChild(vpath.GetSubpath(1), options)); } else { return(null); } }
public ObjectValue CreateObjectValue(bool withTimeout, EvaluationOptions options) { string type = ctx.Adapter.GetTypeName(ctx, exception.Type); ObjectValue excInstance = exception.CreateObjectValue(withTimeout, options); excInstance.Name = "Instance"; ObjectValue messageValue = null; // Get the message if (withTimeout) { messageValue = ctx.Adapter.CreateObjectValueAsync("Message", ObjectValueFlags.None, delegate { ValueReference mref = exception.GetChild("Message", options); if (mref != null) { string val = (string)mref.ObjectValue; return(ObjectValue.CreatePrimitive(null, new ObjectPath("Message"), "System.String", new EvaluationResult(val), ObjectValueFlags.Literal)); } else { return(ObjectValue.CreateUnknown("Message")); } }); } else { ValueReference mref = exception.GetChild("Message", options); if (mref != null) { string val = (string)mref.ObjectValue; messageValue = ObjectValue.CreatePrimitive(null, new ObjectPath("Message"), "System.String", new EvaluationResult(val), ObjectValueFlags.Literal); } } if (messageValue == null) { messageValue = ObjectValue.CreateUnknown("Message"); } messageValue.Name = "Message"; // Inner exception ObjectValue childExceptionValue = null; if (withTimeout) { childExceptionValue = ctx.Adapter.CreateObjectValueAsync("InnerException", ObjectValueFlags.None, delegate { ValueReference inner = exception.GetChild("InnerException", options); if (inner != null && !ctx.Adapter.IsNull(ctx, inner.Value)) { Console.WriteLine("pp got child:" + type); ExceptionInfoSource innerSource = new ExceptionInfoSource(ctx, inner); ObjectValue res = innerSource.CreateObjectValue(false, options); return(res); } else { return(ObjectValue.CreateUnknown("InnerException")); } }); } else { ValueReference inner = exception.GetChild("InnerException", options); if (inner != null && !ctx.Adapter.IsNull(ctx, inner.Value)) { Console.WriteLine("pp got child:" + type); ExceptionInfoSource innerSource = new ExceptionInfoSource(ctx, inner); childExceptionValue = innerSource.CreateObjectValue(false, options); childExceptionValue.Name = "InnerException"; } } if (childExceptionValue == null) { childExceptionValue = ObjectValue.CreateUnknown("InnerException"); } // Stack trace ObjectValue stackTraceValue; if (withTimeout) { stackTraceValue = ctx.Adapter.CreateObjectValueAsync("StackTrace", ObjectValueFlags.None, delegate { return(GetStackTrace(options)); }); } else { stackTraceValue = GetStackTrace(options); } ObjectValue[] children = new ObjectValue [] { excInstance, messageValue, stackTraceValue, childExceptionValue }; return(ObjectValue.CreateObject(null, new ObjectPath("InnerException"), type, "", ObjectValueFlags.None, children)); }