Browse Source

Call "ToString" on objects

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2901 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
b3b9282fa7
  1. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs
  2. 9
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
  3. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs

@ -69,6 +69,11 @@ namespace Debugger.AddIn.TreeModel @@ -69,6 +69,11 @@ namespace Debugger.AddIn.TreeModel
} else {
this.ChildNodes = null;
}
// Do last since it may expire the object
if (val.IsObject) {
this.Text = val.InvokeToString();
}
}
public bool CanSetText {

9
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs

@ -235,6 +235,15 @@ namespace Debugger @@ -235,6 +235,15 @@ namespace Debugger
);
}
/// <summary> Invoke the ToString() method </summary>
public string InvokeToString()
{
if (!IsObject) {
throw new DebuggerException("ToString can be only invoked on object");
}
return Eval.InvokeMethod(Process, typeof(object), "ToString", this, new Value[] {}).AsString;
}
#region Convenience overload methods
/// <summary> Asynchronously invoke the method </summary>

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs

@ -45,10 +45,9 @@ namespace Debugger @@ -45,10 +45,9 @@ namespace Debugger
/// <summary> Gets a string representation of the value </summary>
public string AsString {
get {
if (IsNull) return "<null>";
if (IsNull) return "null";
if (IsArray) return "{" + this.Type.FullName + "}";
if (IsObject) return "{" + this.Type.FullName + "}";
//if (IsObject) return Eval.InvokeMethod(Process, typeof(object), "ToString", this, new Value[] {}).AsString;
if (IsPrimitive) return PrimitiveValue != null ? PrimitiveValue.ToString() : String.Empty;
throw new DebuggerException("Unknown value type");
}

Loading…
Cancel
Save