Skip to content

Commit 42b4668

Browse files
committed
Handling exceptions in AttachToProcess() and Finish() before ForceExit, because otherwise the session is ended and the exception may be ignored.
1 parent 2d9d402 commit 42b4668

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,10 @@ public void AttachToProcess (ProcessInfo proc, DebuggerSessionOptions options)
365365
OnAttachToProcess (proc.Id);
366366
attached = true;
367367
} catch (Exception ex) {
368+
// should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state
369+
var exceptionHandled = HandleException (ex);
368370
ForceExit ();
369-
if (!HandleException (ex))
371+
if (!exceptionHandled)
370372
throw;
371373
}
372374
});
@@ -511,8 +513,10 @@ public void Finish ()
511513
try {
512514
OnFinish ();
513515
} catch (Exception ex) {
516+
// should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state
517+
var exceptionHandled = HandleException (ex);
514518
ForceExit ();
515-
if (!HandleException (ex))
519+
if (!exceptionHandled)
516520
throw;
517521
}
518522
});

0 commit comments

Comments
 (0)