Skip to content

VS Code PowerShell Extension Fails to Load: Continuous Spinning Indicator and Console Prompt Absence #5001

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

Closed
6 tasks done
ioxterminal opened this issue Jun 9, 2024 · 2 comments
Labels
Area-Startup Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!

Comments

@ioxterminal
Copy link

ioxterminal commented Jun 9, 2024

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

The order of the PS module paths on Windows seems to influence the loading behavior of the PowerShell extension in VS Code. If Windows PowerShell module paths are placed on top of the PowerShell 7 module paths, it results in a continuous spinning indicator and the PowerShell terminal never reaching a prompt.

PowerShell Version

PS C:\temp\Posh> $PSVersionTable; $Host

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22635
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.2.2
InstanceId       : c42fd1f7-2a51-4cdb-a300-22f718f1375a
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-GB
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

code --version
1.90.0
89de5a8d4d6205e5b11647eb6a74844ca23d2573
x64

Extension Version

code --list-extensions --show-versions | Select-String powershell

[email protected]

Steps to Reproduce

Steps to Set Up PowerShell 7 in VSCode on Windows 11
Install PowerShell 7:
Download the installer for PowerShell 7 from the official GitHub repository.
Run the installer and follow the on-screen instructions to complete the installation.

Install Visual Studio Code (VSCode):
Download VSCode from the official Visual Studio Code website.
Run the installer and follow the on-screen instructions to install VSCode.
Install the PowerShell Extension for VSCode:

Open VSCode.
Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing Ctrl+Shift+X.
In the Extensions view, search for "PowerShell".
Click on the PowerShell extension and then click Install.

Change System Variable PSModulePath:
Open the Start Menu and search for "Environment Variables".
Select "Edit the system environment variables".
In the System Properties window, click the Environment Variables button.
In the Environment Variables window, find and select the PSModulePath variable under System variables, then click Edit.
Ensure that the PSModulePath includes both the paths for PowerShell 7 and Windows PowerShell. It should look something like:
**C:\Windows\System32\WindowsPowerShell\v1.0\Modules**;C:\Program Files\PowerShell\7\Modules;...
Make sure the path for Windows PowerShell modules is placed on top to reproduce the issue.

Open VSCode.
Open or create a new PowerShell script file (.ps1).
Run the script by pressing F5 or by right-clicking the script file and selecting Run from the context menu.

You should see that the prompt does not appear and the continuous Spinning Indicator

Visuals

2024-06-09 12_35_19-Settings 2024-06-09 12_37_55- 2024-06-09 12_42_44-C__onedrive_Desktop_temp_powershell ticket_2024-06-09 12_37_55- png - Greenshot

Logs

No response

@ioxterminal ioxterminal added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Jun 9, 2024
@JustinGrote
Copy link
Collaborator

Is there a particular reason you're adding in the WindowsPS psmodulespath? You should be using Windows compatibility for those. Have you also tried putting it at the bottom of the psmodulepath search order? My guess is you are loading in an odler module from WinPS that is clobbering a needed PS one.

@JustinGrote JustinGrote added Area-Startup Needs: Author Feedback Please give us the requested feedback! and removed Needs: Triage Maintainer attention needed! labels Jun 10, 2024
Copy link
Contributor

This issue has been labeled as needing feedback and has not had any activity a week. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!
Projects
None yet
Development

No branches or pull requests

2 participants