PowerShell / PowerShell/vscode-powershell
$Host.PushRunspace with a local runspace kills the terminal
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
Trying to run the following:
$NewRunspace = [runspacefactory]::CreateRunspace()
$NewRunspace.Open()
$Host.PushRunspace($NewRunspace)
Will cause the terminal to rapidly write out error messages with no way to stop it without killing the terminal.
I don't expect this to work, but it should throw a notsupported error and recover if I try to do something that isn't supported.
PowerShell Version
Name Value
---- -----
PSVersion 7.5.0-preview.1
PSEdition Core
GitCommitId 7.5.0-preview.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.3.0
InstanceId : b64cd44e-851c-4783-aa4e-b24d4d5cfeae
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : da-DK
CurrentUICulture : da-DK
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.87.0-insider
ec291c126878742ad640055ce604a58129cd088c
x64
Extension Version
ms-vscode.powershell@2024.3.0
Steps to Reproduce
Paste the code from above into the terminal
Visuals
No response
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 reproducing the three-line $Host.PushRunspace example in the VS Code terminal and capture the repeated errors. Trace the extension's terminal and runspace handling; done means the unsupported local runspace operation reports a not-supported error and the terminal remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100