Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
@deadlydog

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 : 202400
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@202400

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /