vscode-powershell: PowerShell Extension terminal hangs when using Windows PowerShell
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
While investigating another issue I switched to “Windows PowerShell (x64)” in the “PowerShell Session Menu.”
Now the session doesn’t start anymore, it hangs at:
PowerShell Extension v2023.6.0
Copyright (c) Microsoft Corporation.
https://aka.ms/vscode-powershell
Type 'help' to get help.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.19041.3031
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3031
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
(assumed, given that I can't get that PowerShell version to run within VScode)
Visual Studio Code Version
1.81.1
6c3e3dba23e8fadc360aed75ce363ba185c49794
x64
Extension Version
ms-vscode.powershell@2023.6.0
TylerLeonhardt.vscode-inline-values-powershell@0.0.7
Steps to Reproduce
- switch to “Windows PowerShell (x64)” via the PowerShell Session Menu (resulting in
powershell.powerShellDefaultVersionbeing set toWindows PowerShell (x64). - A “session restart” occurs
- The session never finishes initializing
When powershell.powerShellDefaultVersion is set to PowerShell (x64) the problem goes away.
(I know support for Windows PowerShell 5.1 is “best effort”)
Visuals
No response
Logs
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 25 (4 by maintainers)
@sba923,
yes, this is still an issue for me. I resorted to using Windows PowerShell ISE to edit and debug my script for Windows PowerShell 5.1, so while this is a workaround the issue raised by this work item still applies to me and isn’t seemingly related to oh-my-posh. I have oh-my-posh installed, but this problem remains even when I have profile loading disabled.I just went through and updated everything (Oh-My-Posh, PowerShell 7.4.0), again, and restarted VSCode. The extension is now working with Windows PowerShell 5.1, so this has been resolved now for me. Neither update seems as though it should have had an impact, because the 5.1 profile wasn’t being loaded, only
$PROFILE.CurrentUserCurrentHostexists for both Windows PowerShell 5.1 and PowerShell Core 7.4.0, different scripts, and with regard to Windows PowerShell$PROFILE.CurrentUserCurrentHostonly adds a directory to the$env:Pathso Oh-My-Posh wasn’t being initiated at all. I’m not sure what changed to make it work.@sba923 last time I checked 5 worked, but also on my end that’s “best effort”. It’s legacy 😅
I’ve found the culprit, and it’s not
PSReadLine-related.Wrapping the loading of
oh-my-poshwithingives me a working session.
I’ll ping @JanDeDobbeleer about this.