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

$Host.PushRunspace with a local runspace kills the terminal #4921

Open
6 tasks done
MartinGC94 opened this issue Feb 16, 2024 · 1 comment
Open
6 tasks done

$Host.PushRunspace with a local runspace kills the terminal #4921

MartinGC94 opened this issue Feb 16, 2024 · 1 comment
Labels
Area-Engine Issue-Bug A bug to squash. Up for Grabs Will shepherd PRs.

Comments

@MartinGC94
Copy link
Contributor

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

@MartinGC94 MartinGC94 added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Feb 16, 2024
@SeeminglyScience
Copy link
Collaborator

Yeah makes sense. I think ConsoleHost in PowerShell also needs a check, it just happens to fail due to an NRE iirc

@SydneyhSmith SydneyhSmith added Area-Engine Up for Grabs Will shepherd PRs. and removed Needs: Triage Maintainer attention needed! labels Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Engine Issue-Bug A bug to squash. Up for Grabs Will shepherd PRs.
Projects
Status: Wishlist
Development

No branches or pull requests

3 participants