vscode-powershell
vscode-powershell copied to clipboard
Terminating a running script with Ctrl + C does not stop the debugger when using createTemporaryIntegratedConsole
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all open and closed issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- [X] If this is a security issue, I have read the security issue reporting guidance.
Summary
When using the powershell.debugging.createTemporaryIntegratedConsole
setting, if you use Ctrl
+C
to cancel a running script the PowerShell debugger does not stop; it stays running until you manually stop it. This also prevents you from rerunning the script until you manually stop the debugger.
This is the same as issue #3700 that was fixed, except it still occurs when the createTemporaryIntegratedConsole
setting is enabled.
PowerShell Version
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name : Visual Studio Code Host
Version : 2024.0.0
InstanceId : 7764663a-9b11-478d-90a6-4afd3d3fd09e
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.86.2
903b1e9d8990623e3d7da1df3d33db3e42d80eda
x64
Extension Version
[email protected]
Steps to Reproduce
- Ensure the
powershell.debugging.createTemporaryIntegratedConsole
settings is enabled. - Run a PowerShell script. e.g.
for ($i = 0; $i -lt 10; $i++) { Write-Host "Running script. Press Ctrl+C to cancel script. $i" Start-Sleep -Seconds 1 }
- Press
Ctrl
+C
to cancel the script. - Notice that the script stopped running, but the PowerShell debugger is still running and must be manually stopped.
Visuals
Here is a gif showing the problem. You can see that the powershell.debugging.createTemporaryIntegratedConsole
setting is enabled and that a temporary terminal is created after pressing F5
to start the script. After pressing Ctrl
+C
to stop the script, the debugger stays running until I manually click the stop button on the debugger toolbar.
Logs
No response