Skip to content

Windows Powershell (x64) Session will not start - seems like #118289 #4012

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
5 of 6 tasks
ro-epp opened this issue Jun 7, 2022 · 48 comments
Closed
5 of 6 tasks

Windows Powershell (x64) Session will not start - seems like #118289 #4012

ro-epp opened this issue Jun 7, 2022 · 48 comments
Labels
Issue-Bug A bug to squash.

Comments

@ro-epp
Copy link

ro-epp commented Jun 7, 2022

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all 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

My issue is that the Windows PowerShell Session (x64) will not finish loading/launching. 32bit will load, but does not have access to 64bit tools. I have installed the last December version and the Windows PowerShell Session (x64) successfully loaded, 2022.5.0 did not load the powershell session. I even changed "set ELECTRON_RUN_AS_NODE=1" to 0,
Below are the logs for the extension service.

PowerShell Version

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

Visual Studio Code Version

1.67.2
c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
x64

Extension Version

Steps to Reproduce

open VS Code and open/create a ps1 file to get the extension to load.

Visuals

No response

Logs

6/7/2022 2:42:20 PM [NORMAL] - Language server starting --
6/7/2022 2:42:20 PM [NORMAL] - PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
6/7/2022 2:42:20 PM [NORMAL] -
WARNING: In development mode but PowerShellEditorServices dev module path cannot be found (or has not been built yet): c:\Users\re1.vscode\extensions\PowerShellEditorServices\module

6/7/2022 2:42:20 PM [NORMAL] - PowerShell args: -NoProfile -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2022.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\logs\1654630940-2a4fc57d-2bd6-4f0f-8f6d-a94ae1f80f271654630932896\EditorServices.log' -SessionDetailsPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\sessions\PSES-VSCode-20164-991690' -FeatureFlags @()
6/7/2022 2:42:20 PM [NORMAL] - Waiting for session file
6/7/2022 2:42:20 PM [NORMAL] - powershell.exe started.
6/7/2022 2:42:20 PM [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2022.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\logs\1654630940-2a4fc57d-2bd6-4f0f-8f6d-a94ae1f80f271654630932896\EditorServices.log' -SessionDetailsPath 'c:\Users\re1.vscode\extensions\ms-vscode.powershell-2022.5.1\sessions\PSES-VSCode-20164-991690' -FeatureFlags @()
6/7/2022 2:42:22 PM [NORMAL] - Session file found
6/7/2022 2:42:22 PM [NORMAL] - Registering terminal close callback
6/7/2022 2:42:22 PM [NORMAL] - Registering terminal PID log callback
6/7/2022 2:42:22 PM [NORMAL] - Language server started.
6/7/2022 2:42:22 PM [NORMAL] - powershell.exe PID: 9100
6/7/2022 2:42:22 PM [NORMAL] - Connecting to language service on pipe \.\pipe\PSES_hltubtat.brd...
6/7/2022 2:42:22 PM [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\.\pipe\PSES_hltubtat.brd","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\.\pipe\PSES_3mf5vomg.hfa"}
6/7/2022 2:42:22 PM [NORMAL] - Language service connected.
6/7/2022 2:47:23 PM [WARNING] - Invalid Version: null

@ro-epp ro-epp added the Issue-Bug A bug to squash. label Jun 7, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jun 7, 2022
@SydneyhSmith
Copy link
Collaborator

Thanks @ro-epp does this reproduce with PowerShell 7.x or just Windows PowerShell? Also have you tried uninstalling and reinstalling VSCode...seems like something strange may be going on with VSCode...thanks

@SydneyhSmith SydneyhSmith added Needs: Repro Info 🤔 and removed Needs: Triage Maintainer attention needed! labels Jun 13, 2022
@ShikeChen-MS
Copy link

Same here, I am on PowerShell 7.2.4 and the integrated console does not start.

@mwander-chwy
Copy link

mwander-chwy commented Jun 14, 2022

Same here, I am on PowerShell 7.2.4 and the integrated console does not start. I should mention it does run on Windows PowerShell 5.1.
Capture

After some time I press Ctrl-C and get this:
Capture2
Capture3

My log file looks practically the same as the above log file. Except I'm using 7.2.4

@andyleejordan
Copy link
Member

Can you try the preview extension?

@ShikeChen-MS
Copy link

Just tried preview, same result:
1

@andyleejordan
Copy link
Member

I see OnCancelKeyPress in your log...did you hit Ctrl-C perhaps?

@ro-epp
Copy link
Author

ro-epp commented Jun 15, 2022

I have not tried 7.2.4 because nothing else in my environment uses it and I cannot clearly verify what will not work on 5.1 (I am probably just misunderstanding the notes).

@ro-epp
Copy link
Author

ro-epp commented Jun 15, 2022

Update:
There was a new version of VSCode that was available, 1.68.0. That seems to have cleared up the issue with the x64 session starting. Hopefully 1.68.1 does not make the issue recur.

@ShikeChen-MS
Copy link

I see OnCancelKeyPress in your log...did you hit Ctrl-C perhaps?

Yes, I have to hit ctrl-c otherwise, it will just hanging there with no output

@ShikeChen-MS
Copy link

Update: There was a new version of VSCode that was available, 1.68.0. That seems to have cleared up the issue with the x64 session starting. Hopefully 1.68.1 does not make the issue recur.

I am currently on VSCode 1.68.1.
As following info shows (copied from vscode)

Version: 1.68.1 (user setup)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:48:58.283Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.22000

@opmdsm
Copy link

opmdsm commented Jun 17, 2022

I also have the same issue. Windows PowerShell (x86) loads, Windows PowerShell (x64) doesn't. I'm on latest Visual Studio Code 1.68.1. Uninstall PowerShell extension and install it again doesn't help. Uninstall Visual Studio Code and install it again also doesn't help. I remember that at very first install of PowerShell extension, Visual Studio Code asked me if I agree with something (with y/n option on console/terminal) and this doesn't happen if I uninstall and install again PowerShell extension or Visual Studio Code. So to me looks like some info is kept at OS level that prevents PowerShell (x64) to load. I'm on Win 10, PowerShell 5.1

VSC

@mrjcap
Copy link

mrjcap commented Jun 17, 2022

I had the same issue (powershell 7.2.4) for several days and I decided to dig a little deeper.

In my case, when I was starting vscode, pwsh.exe was creating a child process of powershell.exe

After hours of troubleshooting, reinstalling, and reconfiguring pretty much everything. I still couldn't figure out what causing the powershell.exe process to launch.

Finally, I removed the following path from the environment variables: C:\Windows\System32\WindowsPowerShell\v1.0\ from PATH.
And: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules from PSModulePath.

Then I was able to start the integrated console successfully.

Another thing I noticed when I did a trace with procmon. There was a lot of activity (37000 read operations) with the StartupProfileData-Interactive file.

@opmdsm
Copy link

opmdsm commented Jun 17, 2022

I had the same issue (powershell 7.2.4) for several days and I decided to dig a little deeper.

In my case, when I was starting vscode, pwsh.exe was creating a child process of powershell.exe

After hours of troubleshooting, reinstalling, and reconfiguring pretty much everything. I still couldn't figure out what causing the powershell.exe process to launch.

Finally, I removed the following path from the environment variables: C:\Windows\System32\WindowsPowerShell\v1.0 And: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules from PSModulePath.

Then I was able to start integrated console successfully.

Another thing I noticed when I did a trace with procmon. There was a lot of activity (37000 read operations) with the StartupProfileData-Interactive file.

Thanks for the tip. I don't have C:\Windows\System32\WindowsPowerShell\v1.0 in PSModulePath but I have the other one: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules. Removing this causes both of them to not start (PowerShell x86 & x64). Put it back, x86 working again, x64 still no go.

@mwander-chwy
Copy link

It worked for me so thank you @mrjcap worked flawlessly for me !!!!!! Finally back up and running!

@mrjcap
Copy link

mrjcap commented Jun 17, 2022

I had the same issue (powershell 7.2.4) for several days and I decided to dig a little deeper.
In my case, when I was starting vscode, pwsh.exe was creating a child process of powershell.exe
After hours of troubleshooting, reinstalling, and reconfiguring pretty much everything. I still couldn't figure out what causing the powershell.exe process to launch.
Finally, I removed the following path from the environment variables: C:\Windows\System32\WindowsPowerShell\v1.0 And: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules from PSModulePath.
Then I was able to start integrated console successfully.
Another thing I noticed when I did a trace with procmon. There was a lot of activity (37000 read operations) with the StartupProfileData-Interactive file.

Thanks for the tip. I don't have C:\Windows\System32\WindowsPowerShell\v1.0 in PSModulePath but I have the other one: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules. Removing this causes both of them to not start (PowerShell x86 & x64). Put it back, x86 working again, x64 still no go.

Sorry about that.

I should've mentioned that C:\Windows\System32\WindowsPowerShell\v1.0 is in PATH. Not in PSModulePath.

I have updated my reply.

@andyleejordan
Copy link
Member

What do you all have configured for your PowerShell additional exe paths?

"powershell.powerShellAdditionalExePaths": {}

and your PowerShell default version?

"powershell.powerShellDefaultVersion": ""

Thanks!

@mrjcap
Copy link

mrjcap commented Jun 17, 2022

Capture

@ShikeChen-MS
Copy link

I had the same issue (powershell 7.2.4) for several days and I decided to dig a little deeper.

In my case, when I was starting vscode, pwsh.exe was creating a child process of powershell.exe

After hours of troubleshooting, reinstalling, and reconfiguring pretty much everything. I still couldn't figure out what causing the powershell.exe process to launch.

Finally, I removed the following path from the environment variables: C:\Windows\System32\WindowsPowerShell\v1.0\ from PATH. And: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules from PSModulePath.

Then I was able to start the integrated console successfully.

Another thing I noticed when I did a trace with procmon. There was a lot of activity (37000 read operations) with the StartupProfileData-Interactive file.

Thanks, this workaround works for me.

However, with that said, I am still wondering what's the root cause is and hope it can be solved. Removing staff from environment variable doesn't seems to be a good permanant solution.

@andyleejordan
Copy link
Member

Hopefully with this information we may be able to reproduce the problem locally, which is 90% of fixing it.

@mrjcap
Copy link

mrjcap commented Jun 17, 2022

Another temporary solution is to downgrade the extension. I tried every version from 2022.1.0 to 2022.5.1.

All the 2022.xx.xx versions had this issue. The only working version I was able to find is: 2021.12.0.

I wouldn't recommend it though.

@opmdsm
Copy link

opmdsm commented Jun 20, 2022

I had the same issue (powershell 7.2.4) for several days and I decided to dig a little deeper.
In my case, when I was starting vscode, pwsh.exe was creating a child process of powershell.exe
After hours of troubleshooting, reinstalling, and reconfiguring pretty much everything. I still couldn't figure out what causing the powershell.exe process to launch.
Finally, I removed the following path from the environment variables: C:\Windows\System32\WindowsPowerShell\v1.0 And: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules from PSModulePath.
Then I was able to start integrated console successfully.
Another thing I noticed when I did a trace with procmon. There was a lot of activity (37000 read operations) with the StartupProfileData-Interactive file.

Thanks for the tip. I don't have C:\Windows\System32\WindowsPowerShell\v1.0 in PSModulePath but I have the other one: %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules. Removing this causes both of them to not start (PowerShell x86 & x64). Put it back, x86 working again, x64 still no go.

Sorry about that.

I should've mentioned that C:\Windows\System32\WindowsPowerShell\v1.0 is in PATH. Not in PSModulePath.

I have updated my reply.

Thanks, but still doesn't work for me. Downgrading extension to 2021.12.0 make it works again.

@andyleejordan
Copy link
Member

Ok, got a lot going on here, trying to summarize it:

  • The original issue posted by @ro-epp was that Windows PowerShell x64 was not starting, this was resolved for them with a VS Code update to 1.68.0
  • @ShikeChen-MS, @mrjcap, and @mwander-chwy all have a separate but similar issue where PowerShell Core 7.2.4 is not loading, they resolved their issues by realizing that pwsh.exe was trying to start powershell.exe, and failing, and so by removing the path to powershell.exe from their system PATH environment.
    • @mrjcap thank you for sharing your configuration. You have specifically set your extension to try to load Windows PowerShell by setting powershell.powerShellDefaultVersion to PowerShell (×64). Instead of editing PATH (and PSModulePath) can you please reset your extension configuration to load PowerShell Core AKA pwsh.exe? I do not believe you need to edit your environment variables nor downgrade the extension, but you do need to correct your extension configuration.
    • @ShikeChen-MS and @mwander-chwy can you both check the same setting please, since your issue appears to be the same as @mrjcap?
  • @opmdsm you seem to have a completely separate issue from any of the others. You're trying to get PowerShell (×64) (Windows PowerShell) to load, but indicate you were asked something at startup. My guess was you were asked if you trusted the editor services startup script, and presumably said no. This will lead to it failing to load silently. Can you please try following these instructions to trust the script?

I have a feeling that the unexpected behavior where Windows PowerShell is being started instead of PowerShell Core can be traced to the accidentally breaking change made to powershell.powerShellAdditionalExePaths in #3919. Please see #3978 for more thorough information on setting up your available PowerShell sessions.

@mrjcap
Copy link

mrjcap commented Jun 20, 2022

@andschwa, I made some progress after applying those changes. Resetting the configuration didn't work.

The reason I am saying that is because I believe when you delete everything related to VS Code and there are no leftovers whatsoever, you should theoretically be able to test it with the default settings.

That wasn’t the case for me. I couldn’t switch to Powershell, only Windows Powershell was working.

Having said that, the first thing I did was to create a new vm, so I could have a working state to compare it.

Test case 1:

  1. Created new Windows 11 VM.
  2. Installed Powershell 7.2.4.
  3. Installed git.
  4. Installed VS Code.
  5. Installed Powershell extension.
  6. Checked settings.json. There is no powershell.powerShellAdditionalExePaths or powershell.powerShellDefaultVersion.
  7. Restarted VS Code.
  8. Session started successfully.

Test case 2:

  1. Uninstalled VS Code.
  2. Deleted .vscode folder
  3. Deleted \AppData\Roaming\Code folder
  4. Installed VS Code.
  5. Installed Powershell extension.
  6. Checked settings.json. There is no powershell.powerShellAdditionalExePaths or powershell.powerShellDefaultVersion.
  7. Restarted VS Code.
  8. The Session failed to start.

Test case 3:

  1. Uninstalled VS Code.
  2. Deleted the .vscode folder
  3. Deleted \AppData\Roaming\Code folder
  4. Downloaded the portable version of VS Code and run it.
  5. Installed powershell extension.
  6. Checked settings.json. There is no powershell.powerShellAdditionalExePaths or powershell.powerShellDefaultVersion.
  7. Restarted VS Code.
  8. The Session failed to start.

@andyleejordan
Copy link
Member

What are test cases 2 and 3 attempting to test?

@mrjcap
Copy link

mrjcap commented Jun 20, 2022

The non-working state.

@andyleejordan
Copy link
Member

What if you set up test cases 2 and 3 to explicitly load PowerShell Core?

@mrjcap
Copy link

mrjcap commented Jun 20, 2022

I will have to test it tomorrow and let you know.

@opmdsm
Copy link

opmdsm commented Jun 21, 2022

Ok, got a lot going on here, trying to summarize it:

  • The original issue posted by @ro-epp was that Windows PowerShell x64 was not starting, this was resolved for them with a VS Code update to 1.68.0

  • @ShikeChen-MS, @mrjcap, and @mwander-chwy all have a separate but similar issue where PowerShell Core 7.2.4 is not loading, they resolved their issues by realizing that pwsh.exe was trying to start powershell.exe, and failing, and so by removing the path to powershell.exe from their system PATH environment.

    • @mrjcap thank you for sharing your configuration. You have specifically set your extension to try to load Windows PowerShell by setting powershell.powerShellDefaultVersion to PowerShell (×64). Instead of editing PATH (and PSModulePath) can you please reset your extension configuration to load PowerShell Core AKA pwsh.exe? I do not believe you need to edit your environment variables nor downgrade the extension, but you do need to correct your extension configuration.
    • @ShikeChen-MS and @mwander-chwy can you both check the same setting please, since your issue appears to be the same as @mrjcap?
  • @opmdsm you seem to have a completely separate issue from any of the others. You're trying to get PowerShell (×64) (Windows PowerShell) to load, but indicate you were asked something at startup. My guess was you were asked if you trusted the editor services startup script, and presumably said no. This will lead to it failing to load silently. Can you please try following these instructions to trust the script?

I have a feeling that the unexpected behavior where Windows PowerShell is being started instead of PowerShell Core can be traced to the accidentally breaking change made to powershell.powerShellAdditionalExePaths in #3919. Please see #3978 for more thorough information on setting up your available PowerShell sessions.

Yes, I have been asked but only once, at the very first extension installation. Don't recall exactly what was the question. After that, no matter what I did (uninstall extension or VS Code and install again) I didn't get it anymore. The script is trusted, tried your suggestions with same results, PowerShell x64 doesn't load. I've checked powershell.powerShellDefaultVersion and is empty. Should I have something in it?

@mrjcap
Copy link

mrjcap commented Jun 21, 2022

@andschwa,

I changed the powerShellDefaultVersion to PowerShell Core and now it seems that I cannot reproduce the issue.

@opmdsm
Copy link

opmdsm commented Jun 21, 2022

I did some more tests on 2 different machines: Win 10 and Win 2022. The question that I was talking about in previous posts is not when installing PowerShell extension (my bad), but when opening an existing ps1 file or PowerShell workspace. In both cases I answer yes, I trust them.

The steps were exactly the same as follows:

  1. Install VS Code (Setup) and start as admin
  2. Install PowerShell extension
  3. Open an existing workspace or ps1 file. I tried both and trust them.

The difference:
On Win 2022, everything went ok.
On Win 10, I got what is in below picture. In addition to that, PowerShell extension is not loading.

Capture

After some time I got this:

Capture1

And here are the logs (I replaced my user name with <USER_NAME>)

Logs.txt

Maybe it helps.

After waiting additional time, finally PowerShell session was started. This is as close I can get to reproduce the issue. On my PC, the loading is still not happening.

@andyleejordan
Copy link
Member

@andschwa,

I changed the powerShellDefaultVersion to PowerShell Core and now it seems that I cannot reproduce the issue.

@mrjcap are you opening Code via the command-line? As in, are you in a pwsh session, and running code, so the process tree looks like pwsh->code->pwsh (and when it was "broken" it looked like pwsh->code->powershell)? If so I think the reason it wasn't working was due to #3886, and I bet you could get "PowerShell (x64)" i.e. powershell to work if the tree was instead powershell->code->powershell (or take out the first PowerShell process completely and start Code from its shortcut).

@andyleejordan
Copy link
Member

andyleejordan commented Jun 21, 2022

I did some more tests on 2 different machines: Win 10 and Win 2022. The question that I was talking about in previous posts is not when installing PowerShell extension (my bad), but when opening an existing ps1 file or PowerShell workspace. In both cases I answer yes, I trust them.

The steps were exactly the same as follows:

  1. Install VS Code (Setup) and start as admin
  2. Install PowerShell extension
  3. Open an existing workspace or ps1 file. I tried both and trust them.

The difference: On Win 2022, everything went ok. On Win 10, I got what is in below picture. In addition to that, PowerShell extension is not loading.

Capture

After some time I got this:

Capture1

And here are the logs (I replaced my user name with <USER_NAME>)

Logs.txt

Maybe it helps.

After waiting additional time, finally PowerShell session was started. This is as close I can get to reproduce the issue. On my PC, the loading is still not happening.

@opmdsm On your Windows 10 machine, can you try installing WMF 5.1 per here?

@mrjcap
Copy link

mrjcap commented Jun 22, 2022

@andschwa,
I changed the powerShellDefaultVersion to PowerShell Core and now it seems that I cannot reproduce the issue.

@mrjcap are you opening Code via the command-line? As in, are you in a pwsh session, and running code, so the process tree looks like pwsh->code->pwsh (and when it was "broken" it looked like pwsh->code->powershell)? If so I think the reason it wasn't working was due to #3886, and I bet you could get "PowerShell (x64)" i.e. powershell to work if the tree was instead powershell->code->powershell (or take out the first PowerShell process completely and start Code from its shortcut).

No, I am not. I am starting it from the shortcut.

Here is a screenshot from procmon:

not_working

And here as screenshot when it's working:

working

And a comparison of the read/write operations:

comparison

As you can see it only takes 3 read operations when it's working and around 30000 operations when it's not.

I hope this helps.

@opmdsm
Copy link

opmdsm commented Jun 22, 2022

I did some more tests on 2 different machines: Win 10 and Win 2022. The question that I was talking about in previous posts is not when installing PowerShell extension (my bad), but when opening an existing ps1 file or PowerShell workspace. In both cases I answer yes, I trust them.
The steps were exactly the same as follows:

  1. Install VS Code (Setup) and start as admin
  2. Install PowerShell extension
  3. Open an existing workspace or ps1 file. I tried both and trust them.

The difference: On Win 2022, everything went ok. On Win 10, I got what is in below picture. In addition to that, PowerShell extension is not loading.
Capture
After some time I got this:
Capture1
And here are the logs (I replaced my user name with <USER_NAME>)
Logs.txt
Maybe it helps.
After waiting additional time, finally PowerShell session was started. This is as close I can get to reproduce the issue. On my PC, the loading is still not happening.

@opmdsm On your Windows 10 machine, can you try installing WMF 5.1 per here?

Hmm... Which one? They say on Win 10 is built in...

image

image

@opmdsm
Copy link

opmdsm commented Jun 22, 2022

Release 2022.6.1 is available and this is the dialog that I was mention earlier:

image

Pressed A and nothing happens:
image

Probably I closed VS Code and that's why I got corrupted PowerShell.
Now what should I do? Wait forever? :)

Is it possible to be because I'm on AzureAD domain and not regular one? I tend to believe that this is a rights issue.

... and more than 1h later same status like in the last picture.

... and finally I restarted VS Code. Same as before :(

@andyleejordan
Copy link
Member

@opmdsm you are right, WMF 5.1 looks to be built-in for your Windows version now. And indeed, that looks like a permissions issue. It is strange, I see you answered A so it should have run.

@andyleejordan
Copy link
Member

@mrjcap You are able to repro this on a VM, correct? If so, can you get a repro on the VM with multiple cores enabled, and then change its configuration to be single core (and reboot it) and see if it still repros? That StartupProfileData-NonInteractive comes from the .NET JIT optimizer, which is only enabled on multi-core machines, so I am hoping this test will reveal if it is indeed a problem with that, or if it's a red herring.

@mrjcap
Copy link

mrjcap commented Jun 22, 2022

@andschwa,

No, I cannot reproduce it on a VM. The non-working version is on a physical machine.

@andyleejordan
Copy link
Member

Well dang 😓

@andyleejordan
Copy link
Member

andyleejordan commented Jun 22, 2022

@mrjcap How about try deleting ~\AppData\Local\Microsoft\PowerShell\StartupProfileData-NonInteractive (the path it's writing to 30,000+ times). We think the documentation says that if it doesn't exist, it won't use it.

@mrjcap
Copy link

mrjcap commented Jun 23, 2022

Yeah, I have done that. When I re-run VS Code, the file is recreated.

@opmdsm
Copy link

opmdsm commented Jun 23, 2022

@opmdsm you are right, WMF 5.1 looks to be built-in for your Windows version now. And indeed, that looks like a permissions issue. It is strange, I see you answered A so it should have run.

@andschwa fyi I have installed PowerShell 7.2.5 (x64) and it works. Still built in Windows PowerShell 5.1 (x64) does not load.

@ghost
Copy link

ghost commented Jul 1, 2022

This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

@mavaddat
Copy link

mavaddat commented Jun 17, 2023

I am getting the same error as long as I am using Windows 10.
ezgif com-optimize

PSVersionTable

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

VS Code Version

1.80.0-insider
x64

Extension verison

System Info

System Info Value
OS Name Microsoft Windows 10 Enterprise
OS Version 10.0.19044 N/A Build 19044
OS Manufacturer Microsoft Corporation
OS Configuration Member Workstation
OS Build Type Multiprocessor Free
Product ID 00329-00000-00003-AA531
Original Install Date 2023-04-12, 5
System Boot Time 2023-06-16, 1
System Model Latitude 5430
System Type x64-based PC
Processor(s) 1 Processor(s) Installed.
[01] Intel64 Family 6 Model 154 Stepping 4 GenuineIntel ~1600 Mhz
CPU Detail 12th Gen Intel(R) Core(TM) i5-1245U (12 x 2496)
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
py29gd2263:30763246
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
pylantcb52:30590116
pyind779:30611226
vscrp:30624060
pythonsymbol12:30651887
showlangstatbar:30737417
pythonms35:30671666
03d35959:30757351
24365598:30687740
pythonfmttext:30716741
pythoncmvfstr:30726892
fixhidewlkth:30724384
showindicator:30766888
pythongtdpath:30726887
bgfeh915:30769767
gsof1:30767484
dh2dc718:30770000
pythonidxpt:30768918
pythondjangots:30768917
pythonnocebcf:30766856
copilotsettingt:30767686
h7j2d465:30769890

PowerShell Session Logs

APPDATA_Code - Insiders_User_globalStorage_ms-vscode.powershell_logs.zip

@ghost
Copy link

ghost commented Jun 17, 2023

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@andyleejordan andyleejordan reopened this Jun 19, 2023
@marius-oloeru
Copy link

I have fixed this by chance. OneDrive corrupted somehow a file from Documents folder: C:\Users<YOUR_USER_NAME>\OneDrive \Documents\WindowsPowerShell\Modules\PackageManagement\1.4.7. Once I ran command chkdsk on C drive, everything was fine. Hope it helps.

@ghost
Copy link

ghost commented Jun 27, 2023

This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

@ZERO-S1GNAL
Copy link

Just dropping by to say it's still an issue and the solution works. VSC v1.98.1, PS extension v2025.0.0 - I also had Security module problems (same as mentioned in one of the posts related to this issue), which are solved by loading it with -Force param.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

10 participants