Skip to content

Loading the PowerShell extension is taking longer than expected #4371

Closed
@dmumladze

Description

@dmumladze

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

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

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.74.3
97dec172d3256f8ca4bfb2143f3f76b503ca0534
x64

Extension Version

ms-vscode.powershell@2022.12.1

Steps to Reproduce

N/A

Visuals

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions