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()
106106
107107 public void SetDebugResuming ( DebuggerResumeAction debuggerResumeAction )
108108 {
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.
109111 _psesHost . SetExit ( ) ;
110112
111113 if ( LastStopEventArgs is not null )
112114 {
113115 LastStopEventArgs . ResumeAction = debuggerResumeAction ;
114116 }
115117
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+ }
118127 }
119128
120129 // This must be called AFTER the new PowerShell has been pushed
You can’t perform that action at this time.
0 commit comments