Skip to content

Commit fd19f89

Browse files
author
David Karlaš
committed
InnerExceptions are now fetched via Indexer instead enumerator so it works with CorDebugger
1 parent a457fbc commit fd19f89

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Mono.Debugging/Mono.Debugging.Evaluation/ExceptionInfoSource.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ public ObjectValue CreateObjectValue (bool withTimeout, EvaluationOptions option
124124
if (inner != null && !ctx.Adapter.IsNull (ctx, inner.Value)) {
125125
var obj = inner.GetValue (ctx);
126126
var objType = ctx.Adapter.GetValueType (ctx, obj);
127-
var enumerator = ctx.Adapter.RuntimeInvoke (ctx, objType, obj, "GetEnumerator", new object [0], new object [0]);
128-
var enumeratorType = ctx.Adapter.GetImplementedInterfaces (ctx, ctx.Adapter.GetValueType (ctx, enumerator)).First (f => ctx.Adapter.GetTypeName (ctx, f) == "System.Collections.IEnumerator");
129-
var childrenList = new List<ObjectValue> ();
130-
while ((bool)ctx.Adapter.TargetObjectToObject (ctx, ctx.Adapter.RuntimeInvoke (ctx, enumeratorType, enumerator, "MoveNext", new object [0], new object [0]))) {
131-
var valCurrent = ctx.Adapter.GetMember (ctx, null, enumeratorType, enumerator, "Current");
132-
childrenList.Add (new ExceptionInfoSource (ctx, valCurrent).CreateObjectValue (withTimeout, ctx.Options));
127+
var count = (int)ctx.Adapter.GetMember(ctx, null, obj, "Count").ObjectValue;
128+
var childrenList = new List<ObjectValue>();
129+
for (int i = 0; i < count; i++) {
130+
childrenList.Add (new ExceptionInfoSource(ctx, ctx.Adapter.GetIndexerReference(ctx, obj, objType, new object[] { ctx.Adapter.CreateValue(ctx, i) })).CreateObjectValue (withTimeout, ctx.Options));
133131
}
134-
return ObjectValue.CreateObject (null, new ObjectPath ("InnerExceptions"), "", "", ObjectValueFlags.None, childrenList.ToArray ());
132+
return ObjectValue.CreateObject (null, new ObjectPath("InnerExceptions"), "", "", ObjectValueFlags.None, childrenList.ToArray ());
135133
}
136134

137135
return ObjectValue.CreateUnknown ("InnerExceptions");

0 commit comments

Comments
 (0)