Skip to content

Commit a1f8fe5

Browse files
committed
Restore GetInfo() and detailed logging on invocation
1 parent 102fa7a commit a1f8fe5

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

Mono.Debugging.Soft/SoftDebuggerAdaptor.cs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,8 +2211,15 @@ public SoftMethodCall (SoftEvaluationContext ctx, MethodMirror function, IInvoca
22112211
}
22122212

22132213
public override string Description {
2214-
get {
2215-
return function.DeclaringType.FullName + "." + function.Name;
2214+
get
2215+
{
2216+
try {
2217+
return function.DeclaringType.FullName + "." + function.Name;
2218+
}
2219+
catch (Exception e) {
2220+
DebuggerLoggingService.LogError ("Exception during getting description of method", e);
2221+
return "[Unknown method]";
2222+
}
22162223
}
22172224
}
22182225

@@ -2264,7 +2271,7 @@ e is AbsentInformationException ||
22642271
tcs.SetException (new EvaluatorException (e.Message));
22652272
}
22662273
else {
2267-
DebuggerLoggingService.LogError ("Unexpected exception has thrown in Invocation", e);
2274+
DebuggerLoggingService.LogError (string.Format ("Unexpected exception has thrown when ending invocation of {0}", GetInfo ()), e);
22682275
tcs.SetException (e);
22692276
}
22702277
}
@@ -2273,12 +2280,32 @@ e is AbsentInformationException ||
22732280
}
22742281
}, null);
22752282
return tcs.Task;
2276-
} catch (Exception) {
2283+
} catch (Exception e) {
22772284
UpdateSessionState ();
2285+
DebuggerLoggingService.LogError (string.Format ("Unexpected exception has thrown when invoking {0}", GetInfo ()), e);
22782286
throw;
22792287
}
22802288
}
22812289

2290+
string GetInfo ()
2291+
{
2292+
try {
2293+
TypeMirror type = null;
2294+
if (obj is ObjectMirror)
2295+
type = ((ObjectMirror)obj).Type;
2296+
else if (obj is TypeMirror)
2297+
type = (TypeMirror)obj;
2298+
else if (obj is StructMirror)
2299+
type = ((StructMirror)obj).Type;
2300+
return string.Format ("method {0} on object {1}",
2301+
function.FullName,
2302+
type == null? "[null]" : type.FullName);
2303+
} catch (Exception ex) {
2304+
DebuggerLoggingService.LogError ("Error getting info for SDB MethodCall", ex);
2305+
return "[Unknown method]";
2306+
}
2307+
}
2308+
22822309
void UpdateSessionState ()
22832310
{
22842311
ctx.Session.StackVersion++;

0 commit comments

Comments
 (0)