Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 4cd87f9

Browse files
committed
avoid using string to check the exception type
1 parent 646c822 commit 4cd87f9

File tree

1 file changed

+4
-2
lines changed
  • main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol

1 file changed

+4
-2
lines changed

main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void UpdateExceptions ()
168168
currentExceptionState = hasCustomExceptions;
169169
var exceptionRequest = new SetExceptionBreakpointsRequest (
170170
Capabilities.ExceptionBreakpointFilters.Where (f => hasCustomExceptions || (f.Default ?? false)).Select (f => f.Filter).ToList ());
171-
exceptionRequest.ExceptionOptions = new List<ExceptionOptions> () { new ExceptionOptions (ExceptionBreakMode.Unhandled)};
171+
exceptionRequest.ExceptionOptions = new List<ExceptionOptions> () {new ExceptionOptions(ExceptionBreakMode.UserUnhandled)};
172172
protocolClient.SendRequest (exceptionRequest, null);
173173
unhandleExceptionRegistered = true;
174174
}
@@ -352,6 +352,7 @@ bool ShouldStopOnExceptionCatchpoint (Catchpoint catchpoint, int frameId)
352352
return string.IsNullOrWhiteSpace (catchpoint.ConditionExpression) || EvaluateCondition (frameId, catchpoint.ConditionExpression) != false;
353353
}
354354

355+
355356
protected void HandleEvent (object sender, EventReceivedEventArgs obj)
356357
{
357358
Task.Run (() => {
@@ -408,7 +409,8 @@ protected void HandleEvent (object sender, EventReceivedEventArgs obj)
408409
// It's OK to evaluate expressions in external code
409410
stackFrame = (VsCodeStackFrame)backtrace.GetFrame (0);
410411
}
411-
if (body.Text.Contains (GettextCatalog.GetString ("but was not handled in user code"))){
412+
var response = protocolClient.SendRequestSync (new ExceptionInfoRequest (body.ThreadId ?? -1));
413+
if (response.BreakMode.Equals (ExceptionBreakMode.UserUnhandled)) {
412414
args = new TargetEventArgs (TargetEventType.UnhandledException);
413415
} else {
414416
if (!breakpoints.Select (b => b.Key).OfType<Catchpoint> ().Any (c => ShouldStopOnExceptionCatchpoint (c, stackFrame.frameId))) {

0 commit comments

Comments
 (0)