vscode-powershell: PowerShell Integrated Console does't start: Running the contributed command: 'PowerShell.ShowSessionMenu' failed.

Issue Description

The PowerShell Integrated Console does not start at all. The problem occurs with every single start of VS Code on my system. So I didn’t manage to get the PowerShell Integrated Console running once. There is a notification saying:

Running the contributed command: 'PowerShell.ShowSessionMenu' failed.

Screenshot grafik

I have test the PowerShell and the PowerShell Preview extension seperatly and the problem occurs with both.

This is a fresh portable installation of Visual Studio Code with (only) the PowerShell extension. Although I have also tested the global installation of Visual Studio Code on my Windows system. I deleted the directories %USERPROFILE%\AppData\Roaming\Code and %USERPROFILE%\.vscode in advance to reset VS Code. The results were the same as with the portable version.

I have added all required and some extra information down below according to the template. Please tell me if I can provide any more useful information!

Attached Logs

.\VSCode-win32-x64-1.53.2\data\extensions\ms-vscode.powershell-2020.6.0\logs\1613468378-ed04d92c-7e5f-45a0-bfa3-6a2d61483c0c1613468364188:

EditorServices.log StartEditorServices.log vscode-powershell.log

Output of the PowerShell Integrated Console in Visual Studio Code:

Output.txt

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17763
VSCode 1.53.2
PowerShell Extension Version 2020.6.0

Installation directory (portable mode)

|- VSCode-win32-x64-1.53.2
|   |- Code.exe
|   |- data
|   |   |- user-data
|   |   |   |- ...
|   |   |- extensions
|   |   |   |- ...
|   |- ...

PowerShell Information

Name Value
PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17763.1490
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Tested with both, the PowerShell and the PowerShell Preview extension seperatly.

Test 1

Extension Author Version
powershell ms-vscode 2020.6.0

Test 2

Extension Author Version
powershell-preview ms-vscode 2020.9.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (9 by maintainers)

Most upvoted comments

I have found I can temporarily resolve the issue on my system by deleting the contents of the following directory, then it will work once:

%AppData%\Code - Insiders\User\workspaceStorage

If I close VS Code or kill the terminal, I need to clear that directory again. For anyone else with this issue, it is a temporary workaround at least.

I just noticed that somebody created an issue about the exact same problem right before me (#3186), but I hope the additional information I provided is still useful.

No I don’t see anything like that in the terminal.

I have found that today I can select the “restart current session” option, and then it seems to load/work after that.

image

As soon as I can fully manage Office 365 with PowerShell 7, I will switch.

I just noticed that both of you are using PowerShell 5 (i.e. desktop PowerShell bundled with Windows) whereas I’m using PowerShell 7.1.2. Let me switch over to PowerShell 5 and see if this repros better.

Thanks for your fast response in trying to solve this.

I get an error with that build of the extension saying could not start language service. The (slightly redacted) logs it displays are below.

2/16/2021 8:39:13 PM [NORMAL] - Visual Studio Code v1.54.0-insider 64-bit
2/16/2021 8:39:13 PM [NORMAL] - PowerShell Preview Extension v2020.9.0
2/16/2021 8:39:13 PM [NORMAL] - Operating System: Windows 64-bit
2/16/2021 8:39:13 PM [NORMAL] - Language server starting --
2/16/2021 8:39:13 PM [NORMAL] -     PowerShell executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
2/16/2021 8:39:13 PM [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.9.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Preview Integrated Console v2020.9.0 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\logs\1613529553-5a5819fd-c90a-44da-b858-ff85bfaf85711613529551509\EditorServices.log' -SessionDetailsPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\sessions\PSES-VSCode-25012-829905' -FeatureFlags @() 
2/16/2021 8:39:13 PM [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.9.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Preview Integrated Console v2020.9.0 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\logs\1613529553-5a5819fd-c90a-44da-b858-ff85bfaf85711613529551509\EditorServices.log' -SessionDetailsPath 'c:\Users\redacted\.vscode-insiders\extensions\ms-vscode.powershell-preview-2020.9.0\sessions\PSES-VSCode-25012-829905' -FeatureFlags @() 
2/16/2021 8:39:13 PM [NORMAL] - powershell.exe started.
2/16/2021 8:39:13 PM [NORMAL] - Waiting for session file
2/16/2021 8:39:15 PM [NORMAL] - Session file found
2/16/2021 8:39:15 PM [NORMAL] - Registering terminal close callback
2/16/2021 8:39:15 PM [NORMAL] - Registering terminal PID log callback
2/16/2021 8:39:15 PM [NORMAL] - powershell.exe PID: 14224
2/16/2021 8:39:15 PM [NORMAL] - Language server started.
2/16/2021 8:39:15 PM [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_x1js0zil.wyy","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_pcyuj5yi.fm2"}
2/16/2021 8:39:15 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_x1js0zil.wyy...
2/16/2021 8:39:15 PM [NORMAL] - Language service connected.
2/16/2021 8:39:15 PM [ERROR] - Could not start language service: 
2/16/2021 8:39:15 PM [ERROR] - Error: Connection to server got closed. Server will not be restarted.

I can repro this locally, so I’ll try to get this sorted out.