-
Notifications
You must be signed in to change notification settings - Fork 513
Loading the PowerShell extension is taking longer than expected #4371
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
Hi, Could you please provide more logging and environment information by following these steps? Thanks! |
I am getting this too since upgrading to MacOS Ventura. Is there some permissions we need to give in System Settings to allow this extension to run? |
My Logs... 1/18/2023 1:27:13 PM [NORMAL] - Visual Studio Code v1.74.3 64-bit 1/18/2023 1:27:13 PM [NORMAL] - Creating log directory at: 'file:///Users/schwinbp/Library/Application%20Support/Code/User/globalStorage/ms-vscode.powershell/logs/1674066432-d4869f1f-9c9d-43c0-a908-2589a79c9bd21674066431924' 1/18/2023 1:27:13 PM [NORMAL] - PowerShell Extension v2022.12.1 1/18/2023 1:27:13 PM [NORMAL] - Operating System: MacOS 64-bit 1/18/2023 1:27:14 PM [NORMAL] - Language server starting -- 1/18/2023 1:27:14 PM [NORMAL] - PowerShell executable: /usr/local/bin/pwsh 1/18/2023 1:27:14 PM [NORMAL] - PowerShell args: -Login -NoProfile -EncodedCommand ******** 1/18/2023 1:27:14 PM [NORMAL] - PowerShell Editor Services args: Import-Module '/Users/schwinbp/.vscode/extensions/ms-vscode.powershell-2022.12.1/modules/PowerShellEditorServices/PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.12.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/Users/schwinbp/.vscode/extensions/ms-vscode.powershell-2022.12.1/modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2022.12.1 https://aka.ms/vscode-powershell 1/18/2023 1:27:14 PM [NORMAL] - pwsh started. 1/18/2023 1:27:14 PM [NORMAL] - Waiting for session file... 1/18/2023 1:27:44 PM [WARNING] - Loading the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance. 1/18/2023 1:31:15 PM [NORMAL] - Timed out waiting for session file to appear! 1/18/2023 1:31:15 PM [ERROR] - PowerShell process failed to start: 1/18/2023 1:31:15 PM [ERROR] - Timed out waiting for session file to appear! 1/18/2023 1:31:15 PM [ERROR] - Unknown session status 'undefined' with reason 'undefined |
That is probably the case. But can you enable diagnostic logging? |
1/18/2023 2:06:59 PM [DIAGNOSTIC] - Loaded settings: https://aka.ms/vscode-powershell |
Only logs I get are these attached. There're no logs in the extensions folder because the extension isn't loaded at that time. |
I was able to repro this issue and resolve it by switching |
Neither settings worked for me. |
Hi all, is this still recurring with v2023.1.0? |
Yes this is occurring on the latest version v2023.1.0. The workaround mentioned above does not work for me because I am running on a managed work pc that still has PS v5 as the Windows Powershell version. So now when I run all my scripts developed in PS 7 core it has to re-download all my modules and then fails on PS7-specific issues. |
This is a major roadblock. As of now, the only thing that at least gets this from failing is by doing what @dmumladze mentioned by setting the The most recent version this works without changing any settings or keeping everything as I have been, is version 2022.11.0 Edit: I've since noticed that some of the built-in functions like |
Same issue here. Haven't used PowerShell Extension on MacOS for a while, but just tried opening it up and ran into this problem. This computer is running MacOS Ventura.
In my VSCode settings, I have the following configuration: "powershell.powerShellAdditionalExePaths": {
"pwshcore": "c:\\users\\trevorsullivan\\scoop\\apps\\pwsh\\current\\pwsh.exe",
"pwshcoremacos": "/usr/local/microsoft/powershell/7/pwsh"
} WorkaroundIt seems that using Mac Homebrew to upgrade PowerShell Core from 7.3.1 to 7.3.2 immediately fixed the issue.
|
I've so far been unable to repro 😭
Glad to hear this, perhaps a step others can try? (Updating to 7.3.2 that is.) |
Hey we were reviewing in triage and @SeeminglyScience caught that @dmumladze, you're trying to use PowerShell 7.1 still. However, that version of PowerShell is past its official end of life (as of May 2022), and therefore support for it was removed, hence the error you're getting. Please upgrade to PowerShell 7.2 LTS or 7.3, latest release. |
@schwinbp, @AdamGrossTX, and @soulshined can you please confirm exactly what version of PowerShell you're using? |
I can't update my PowerShell, it's locked under a group policy. I'll continue to uses default tasks. I see now in the Readme the required version is clearly stated, but as demonstrated by the previous reports, the surprise of the error messages and lack of concise reasoning was a tad frustrating to deal with. I think a more of a direct message in the alert box or log in the output channel would clear a lot of this up instead of what it does now would be helpful. It just runs and runs until it says "taking too long" or status 'undefined' reason 'undefined'. Those are very ambiguous and hard to troubleshoot, therefore hard to get you the info you need to reproduce. But thanks for the update! |
@soulshined please inform your administrator that the group policy is enforcing an end-of-life version of PowerShell. That is, it is not receiving any updates, nor is the underlying version of .NET and this is actually quite risky:
You are right, a better error message would be great. We've so far not done a "pre-emptive" version test of PowerShell because of the amount of time it takes to determine the version of PowerShell being executed. That is, PowerShell has to start before we can get its version (like, we'd need to run Hey, at least we got the update notifier working 😄 |
Not the end of the world to use tasks. Just glad it's sorted out and future users can find this. And trust me I would love to update. Enterprise is enterprise what ya gonna do. Sorry I don't know what all goes into the extension as I haven't looked that deep into it. If vscode doesn't offer prequiste flags outside of package json I would assume spawning a simple node child process to grab the version would suffice prior to trying to load the language server and such. Just slightly confused by your verbiage of 'Powershell must start' But I'll leave that up to you pros! I'm just living in your world |
This is exactly what I meant, it takes a few seconds to do this because .NET / PowerShell is slow to start, so doing it every time before we start the server has been a no-go. But the idea you gave me in this thread is to do it after connection fails, and use the info to make an informed error message. |
I had the exact same problem, and upgrading PowerShell from |
This issue has been marked as answered and has not had any activity in a day. It has been automatically closed for housekeeping purposes. |
@Ted-A you're trying to use PowerShell 7.1 still. However, that version of PowerShell is past its official end of life (as of May 2022), and therefore support for it was removed, hence the error you're getting. Please upgrade to PowerShell 7.2 LTS or 7.3, latest release. |
Hey gang...sorry for delayed response but I was on vacation. I just upgraded to PS 7.3.* and it is working now. Upgrade took awhile. Thanks for the help. |
Great news, thanks for the follow up @schwinbp! |
So I get deprecating these versions, I do. Is there really no way to give users a better error, though? That's a really confusing error to get and doesn't at all point anyone in the right direction to fix things. A short and sweet "the version of PowerShell you're using might be out of date, please update it" would be significantly more helpful. |
Providing vague and obscure error messages is the "way of the developer." How dare you expect a developer to actually expose useful error messages with suggested corrective actions? |
There sure is! Andy talks about the plan to add one a few comments up :P (here) (I missed it too initially FWIW) |
Same here. Maybe because this extension uses the year as it's major version number, this issue crops up in January to bring work to a halt. The downgrade option is found by going to Extensions, scrolling through your Installed extensions to find your Powershell extension. Uncheck Auto Update, then hit the arrow next to Uninstall to install specific version. |
@aarondel4 you should not be downgrading the extension. This issue stems from using PowerShell versions that are past end-of-life. You need to update PowerShell. |
@andyleejordan you should understand the constraints that limit the ability to upgrade PowerShell. This is a viable workaround in certain constrained environments where appropriate caution is taken. Thanks. |
If you are in an environment that cares more about running an unsupported version of PowerShell, with all the potential CVEs and vulnerabilities that will go unfixed because it is unsupported, than it does the effort to run an MSI or automated windows update to the latest LTS version at a minimum (7.4 as of this writing), then yes, I suppose it would be a viable workaround, but I don't recommend it. |
You don't understand what a constrained environment is. I leave it at that since you're taking such an adversarial stance. Not really pertinent to this thread. |
Constrained or not, the version you are running is unsupported. Simple as that. |
I didn't request support. Simple as that. |
Prerequisites
Summary
I cannot debug PowerShell files in Visual Studio Code. As soon as I start vscode, it displays following two errors in the Terminal:
Import-Module: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Start-EditorServices: The term 'Start-EditorServices' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Then the Terminal pane clears and several popup alerts appear saying PowerShell failed to start.
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
N/A
Visuals
Logs
1/13/2023 10:55:51 AM [NORMAL] - Visual Studio Code v1.74.3 64-bit
1/13/2023 10:55:51 AM [NORMAL] - Language server starting --
1/13/2023 10:55:51 AM [NORMAL] - PowerShell Extension v2022.12.1
1/13/2023 10:55:51 AM [NORMAL] - PowerShell executable: C:\Program Files\PowerShell\7\pwsh.exe
1/13/2023 10:55:51 AM [NORMAL] - Operating System: Windows 64-bit
1/13/2023 10:55:51 AM [NORMAL] - PowerShell args: -NoProfile -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\david.vscode\extensions\ms-vscode.powershell-2022.12.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.12.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\david.vscode\extensions\ms-vscode.powershell-2022.12.1\modules' -EnableConsoleRepl -StartupBanner '' -LogLevel 'Normal' -LogPath 'c:\Users\david\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1673625351-7c79dfb0-5e11-49f2-8f28-22219e4a7c461673625349867\EditorServices.log' -SessionDetailsPath 'c:\Users\david\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-28444-434897.json' -FeatureFlags @()
1/13/2023 10:55:51 AM [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\david.vscode\extensions\ms-vscode.powershell-2022.12.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.12.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\david.vscode\extensions\ms-vscode.powershell-2022.12.1\modules' -EnableConsoleRepl -StartupBanner '' -LogLevel 'Normal' -LogPath 'c:\Users\david\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1673625351-7c79dfb0-5e11-49f2-8f28-22219e4a7c461673625349867\EditorServices.log' -SessionDetailsPath 'c:\Users\david\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-28444-434897.json' -FeatureFlags @()
1/13/2023 10:55:51 AM [NORMAL] - pwsh.exe started.
1/13/2023 10:55:51 AM [NORMAL] - Waiting for session file...
1/13/2023 10:56:22 AM [WARNING] - Loading the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance.
1/13/2023 10:59:54 AM [NORMAL] - Timed out waiting for session file to appear!
1/13/2023 10:59:54 AM [ERROR] - PowerShell process failed to start:
1/13/2023 10:59:54 AM [ERROR] - Timed out waiting for session file to appear!
1/13/2023 10:59:54 AM [ERROR] - Unknown session status 'undefined' with reason 'undefined
The text was updated successfully, but these errors were encountered: