Skip to content

Commit 0e4b2c0

Browse files
Avoid stopping the debugger when canceling other tasks in a debug session (#1712)
While we need to cancel the debugger if a debugged task is running and Ctrl-C is issued, we explicitly are not running the debugged task when we're stopped in a breakpoint. Instead, the user can be running unrelated tasks and may wish to cancel them without stopping the debugger.
1 parent 3fa6082 commit 0e4b2c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,12 @@ private void OnCancelKeyPress(object sender, ConsoleCancelEventArgs args)
870870
_cancellationContext.CancelCurrentTask();
871871

872872
// If the current task was running under the debugger, we need to synchronize the
873-
// cancelation with our debug context (and likely the debug server).
874-
StopDebugContext();
873+
// cancelation with our debug context (and likely the debug server). Note that if we're
874+
// currently stopped in a breakpoint, that means the task is _not_ under the debugger.
875+
if (!CurrentRunspace.Runspace.Debugger.InBreakpoint)
876+
{
877+
StopDebugContext();
878+
}
875879
}
876880

877881
private ConsoleKeyInfo ReadKey(bool intercept)

0 commit comments

Comments
 (0)