PowerShell / PowerShell/vscode-powershell
Terminating a running script with Ctrl + C does not stop the debugger when using createTemporaryIntegratedConsole
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- 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
ms-vscode.powershell@2024.0.0
Steps to Reproduce
- Ensure the
powershell.debugging.createTemporaryIntegratedConsolesettings 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+Cto 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by searching for powershell.debugging.createTemporaryIntegratedConsole and tracing the Ctrl+C cancellation path, then compare it with the fix for issue #3700. Reproduce the steps with the provided loop and verify that cancelling stops both the script and debugger, allowing the script to be rerun without manually stopping debugging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100