PowerShell / PowerShell/vscode-powershell

Extension Fails to start using PowerShell 7 if Windows PowerShell module path is above the PS7 module path in $PSMODULEPATH

Open
#5,057 61 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Startup Issue-Bug Needs: Maintainer Attention
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

Hi,

This is the second time when I face this situation.
Scenario: Fresh install of Visual Studio Code (VSC), then install PowerShell extension from Microsoft. Upon requesting to trust publisher, I press A (always trust) in the terminal window and then nothing happens. I leave it for 1-2h without nothing to happen and then force to stop it. Restarting VSC and Windows PowerShell (x64) is never loading, the bottom-right icon is spinning forever. Switching to Windows PowerShell (x86) is working. The first time when this happened was 2-3 years ago and I remember I've spent also lot of time trying to figure out how to fix this. I discovered the fix by mistake: Found a post about OneDrive somehow corrupting some PowerShell (psm/psd) files from Documents folder or someting. Running chkdsk from command propmt fixed the issue. But now this doesn't seems to have any effect. Any ideas what can I do?

Thanks,
Marius.

PowerShell Version
Name                           Value                                                                                                                   
----                           -----                                                                                                                   
PSVersion                      5.1.22621.4249                                                                                                          
PSEdition                      Desktop                                                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                 
BuildVersion                   10.0.22621.4249                                                                                                         
CLRVersion                     4.0.30319.42000                                                                                                         
WSManStackVersion              3.0                                                                                                                     
PSRemotingProtocolVersion      2.3                                                                                                                     
SerializationVersion           1.1.0.1                                                                                                                 

Name             : Windows PowerShell ISE Host
Version          : 5.1.22621.4249
InstanceId       : 64347789-db94-40f5-9118-5d2a0c2cc76b
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.94.0
Extension Version
v2024.2.2
Steps to Reproduce

See Summary section

Visuals

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the VS Code extension startup failure with the Windows PowerShell module path above the PowerShell 7 path in $PSMODULEPATH, using the versions and installation scenario in the issue. Determine the startup failure's cause and verify that the extension starts normally with that path ordering; no specific source file or test is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.