PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 491 forks source link

Hangs during install and when opening ps1m file #2970

Closed apj68 closed 4 years ago

apj68 commented 4 years ago

I've not been able to use this extension at all. When I attempt to install it this is what happens:

  1. Immediately it takes me to the theme selection (either Powershell ISE or Dark (Visual Studio)).
  2. Hangs, completely unresponsive until a dialog pops up to Reopen, Keep Waiting, or Close. a. If I choose Keep Waiting, it will continue the same way, continuously prompting b. If I choose reopen it reloads/opens the window but if I am in any sort of PS file it will hang again, this time with a "Starting Powershell" message in the status bar c. If I choose close it closes the window but then right into same behavior as described above.

The only way out of this loop is to close the window, open a non-PS file and remove the extension.

I'd really like to use the extension and seems there aren't a lot of other people with this issue. Can anyone suggest some troubleshooting?

PS C:\> $PSVersiontable

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\Users\O386600\workspaces\cmdline\mpweb\MpWebModule> code --list-extensions | % { "code --install-extension $_" }
code --install-extension alefragnani.Bookmarks
code --install-extension asciidoctor.asciidoctor-vscode
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension dbaeumer.vscode-eslint
code --install-extension dbankier.vscode-quick-select
code --install-extension drcallaway.vscode-surround-with
code --install-extension eamodio.gitlens
code --install-extension eg2.vscode-npm-script
code --install-extension hiro-sun.vscode-emacs
code --install-extension jasonnutter.search-node-modules
code --install-extension joaompinto.asciidoctor-vscode
code --install-extension marlon407.code-groovy
code --install-extension mtxr.sqltools
code --install-extension naco-siren.gradle-language
code --install-extension Pivotal.vscode-boot-dev-pack
code --install-extension Pivotal.vscode-concourse
code --install-extension Pivotal.vscode-manifest-yaml
code --install-extension Pivotal.vscode-spring-boot
code --install-extension redhat.java
code --install-extension richardwillis.vscode-gradle
code --install-extension ryu1kn.edit-with-shell
code --install-extension siegebell.incremental-search
code --install-extension slevesque.vscode-autohotkey
code --install-extension slevesque.vscode-multiclip
code --install-extension SolarLiner.linux-themes
code --install-extension SonarSource.sonarlint-vscode
code --install-extension suntobright.vscode-sftp
code --install-extension VisualStudioExptTeam.vscodeintellicode
code --install-extension vmsynkov.colonize
code --install-extension vscjava.vscode-java-debug
code --install-extension vscjava.vscode-java-dependency
code --install-extension vscjava.vscode-java-pack
code --install-extension vscjava.vscode-java-test
code --install-extension vscjava.vscode-maven
code --install-extension vscjava.vscode-spring-boot-dashboard
code --install-extension vscjava.vscode-spring-initializr
code --install-extension waderyan.nodejs-extension-pack
code --install-extension xabikos.JavaScriptSnippets
code --install-extension xyz.local-history
SydneyhSmith commented 4 years ago

Thanks @apj68 we recently published an update to our Preview extension which has addressed a number of underlying issues and added some more error messages which are helpful for diagnosing the issue...would you mind giving it a try and letting us know if you are still hitting this issue?

apj68 commented 4 years ago

@SydneyhSmith , thanks! I tried preview9 and had the same results so then I removed all my extensions and ONLY loaded preview9. It did hang but after waiting a couple of times it did become functional. So I thought maybe it was my extensions so I tried the same thing with preview6 and the hanging persisted and I couldn't make it work. So I went back to preview9 which, again, it did hang during the process (saying something like "Loading the Powershell extension is taking longer than expected"), but after a couple of times waiting it did come back.

Our administrators have our $profile on a network drive that is excruciatingly slow. For a regular PS session I use a shortcut for which I use -noprofile then invoke a profile script in a local path. I don't know if that could have something to do with it but with preview6, it doesn't matter how long I wait, it seems to never come up. Could the extension be trying to load the network profile?

rjmholt commented 4 years ago

@apj68 The PowerShell extension uses its own profile, and the backing process is started with -noprofile. However, if you've got things like a network drive on the module path, that could also cause this.

Another big cause of startup hangs we see is antivirus -- is it possible that is playing a role for you?

apj68 commented 4 years ago

AH, ok.. yes, I'm in a corporate environment we have all sorts of antivirus software that can't be shutoff. Might there be a way to rule out or confirm if it's antivirus? I didn't find anything in the event logs.

TylerLeonhardt commented 4 years ago

@apj68 does your organization use BeyondSoft or Avecto privilege management?

apj68 commented 4 years ago

Yes, we use BeyondTrust by BeyondSoft. I do have elevate privileges for some things. Let me try running as admin and see what happens.

apj68 commented 4 years ago

The performance seems about the same running as admin or not. In any case, I guess this is a known issue w/privilege management. At least it works in preview9, I couldn't get control to return at all using preview6.

rkeithhill commented 4 years ago

@apj68 You have PowerBreaker, er PowerBroker on your system too? My condolences - same here. BTW there is a tool that comes with PB called polmon.exe that will show when PB intercepts process launches. Also, I'm not sure this is specific to our company or PB in general, but we are told to find the original exe, right-click and select Run Elevated and not Run as Administrator.

apj68 commented 4 years ago

I'm not sure if we have that one, which surprises me because if it's a burden and slows thing down we usually have it 😉

We do use BeyondTrust the same way, although sometimes it seems the Run with PrivilegeGuard is not available but Run as Administrator is. I've tried this both ways and it takes a couple minutes (with preview9) to get vscode up and running with either.

TylerLeonhardt commented 4 years ago

We've heard the 32bit Windows PowerShell is faster with BeyondSoft for what it's worth. It's unclear how BeyondSoft slows us down so much but it seems to be the cause :(