File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/PowerShellEditorServices/Services/PowerShell/Debugging Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -106,15 +106,24 @@ public void StepOver()
106
106
107
107
public void SetDebugResuming ( DebuggerResumeAction debuggerResumeAction )
108
108
{
109
+ // NOTE: We exit because the paused/stopped debugger is currently in a prompt REPL, and
110
+ // to resume the debugger we must exit that REPL.
109
111
_psesHost . SetExit ( ) ;
110
112
111
113
if ( LastStopEventArgs is not null )
112
114
{
113
115
LastStopEventArgs . ResumeAction = debuggerResumeAction ;
114
116
}
115
117
116
- // We need to tell whatever is happening right now in the debug prompt to wrap up so we can continue
117
- _psesHost . CancelCurrentTask ( ) ;
118
+ // We need to tell whatever is happening right now in the debug prompt to wrap up so we
119
+ // can continue. However, if the host was initialized with the console REPL disabled,
120
+ // then we'd accidentally cancel the debugged task since no prompt is running. We can
121
+ // test this by checking if the UI's type is NullPSHostUI which is used specifically in
122
+ // this scenario. This mostly applies to unit tests.
123
+ if ( _psesHost . UI is not NullPSHostUI )
124
+ {
125
+ _psesHost . CancelCurrentTask ( ) ;
126
+ }
118
127
}
119
128
120
129
// This must be called AFTER the new PowerShell has been pushed
You can’t perform that action at this time.
0 commit comments