Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating a running script with Ctrl + C does not stop the debugger when using createTemporaryIntegratedConsole #4927

Open
6 tasks done
deadlydog opened this issue Feb 25, 2024 · 0 comments
Labels
Area-Debugging Issue-Bug A bug to squash. Issue-Discussion Let's talk about it.

Comments

@deadlydog
Copy link

deadlydog commented Feb 25, 2024

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

  1. Ensure the powershell.debugging.createTemporaryIntegratedConsole settings is enabled.
  2. 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
    }
    
  3. Press Ctrl + C to cancel the script.
  4. 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.

VS Code debugger stays running after script is cancelled

Logs

No response

@deadlydog deadlydog added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Feb 25, 2024
@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Discussion Let's talk about it. and removed Needs: Triage Maintainer attention needed! labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Issue-Bug A bug to squash. Issue-Discussion Let's talk about it.
Projects
None yet
Development

No branches or pull requests

2 participants