-
Notifications
You must be signed in to change notification settings - Fork 511
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
Comments
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 |
Same here, I am on PowerShell 7.2.4 and the integrated console does not start. |
Can you try the preview extension? |
I see |
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). |
Update: |
Yes, I have to hit ctrl-c otherwise, it will just hanging there with no output |
I am currently on VSCode 1.68.1.
|
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 |
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. 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 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. |
It worked for me so thank you @mrjcap worked flawlessly for me !!!!!! Finally back up and running! |
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. |
What do you all have configured for your PowerShell additional exe paths?
and your PowerShell default version?
Thanks! |
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. |
Hopefully with this information we may be able to reproduce the problem locally, which is 90% of fixing it. |
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. |
Thanks, but still doesn't work for me. Downgrading extension to 2021.12.0 make it works again. |
Ok, got a lot going on here, trying to summarize it:
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 |
@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:
Test case 2:
Test case 3:
|
What are test cases 2 and 3 attempting to test? |
The non-working state. |
What if you set up test cases 2 and 3 to explicitly load PowerShell Core? |
I will have to test it tomorrow and let you know. |
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? |
I changed the powerShellDefaultVersion to PowerShell Core and now it seems that I cannot reproduce the issue. |
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:
The difference: After some time I got this: And here are the logs (I replaced my user name with <USER_NAME>) 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. |
@mrjcap are you opening Code via the command-line? As in, are you in a |
@opmdsm On your Windows 10 machine, can you try installing WMF 5.1 per here? |
No, I am not. I am starting it from the shortcut. Here is a screenshot from procmon: And here as screenshot when it's working: And a comparison of the read/write operations: 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. |
Hmm... Which one? They say on Win 10 is built in... |
@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 |
@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 |
No, I cannot reproduce it on a VM. The non-working version is on a physical machine. |
Well dang 😓 |
@mrjcap How about try deleting |
Yeah, I have done that. When I re-run VS Code, the file is recreated. |
@andschwa fyi I have installed PowerShell 7.2.5 (x64) and it works. Still built in Windows PowerShell 5.1 (x64) does not load. |
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! |
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. |
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. |
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! |
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. |
Prerequisites
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
Visual Studio Code Version
Extension Version
[email protected]
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
The text was updated successfully, but these errors were encountered: