PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.69k stars 481 forks source link

The language service could not be started: Exception encountered starting EditorServices #2965

Closed H1-N1 closed 3 years ago

H1-N1 commented 4 years ago

System Details Operating system name and version: Windows 7 (x32) VS Code version: 1.49.1 PowerShell extension version: 2020.6.0 Output from $PSVersionTable:

PS C:\Users\W> $PSVersionTable

Name Value


PSVersion 5.1.14409.1005 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.14409.1005 CLRVersion 4.0.30319.17929 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

Issue Description Terminal does not work. outputing ERROR Exception Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 248 in EndProcessing: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.GetPSVersion() at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LogPowerShellDetails() at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LogHostInformation() at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadAndRunEditorServicesAsync() at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()

== Press any key to close terminal ==

Attached Logs

21/09/2020 20:08:55 [NORMAL] - Visual Studio Code v1.49.1 32-bit 21/09/2020 20:08:55 [NORMAL] - PowerShell Extension v2020.6.0 21/09/2020 20:08:55 [NORMAL] - Operating System: Windows 32-bit 21/09/2020 20:08:55 [NORMAL] - Language server starting -- 21/09/2020 20:08:55 [NORMAL] - PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 21/09/2020 20:08:55 [NORMAL] - PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <===== " -LogLevel 'Normal' -LogPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1600711735-dcb2017c-f366-4915-b1e2-402c1ba6dd991600711712286\EditorServices.log' -SessionDetailsPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-3096-381252' -FeatureFlags @() 21/09/2020 20:08:55 [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <===== " -LogLevel 'Normal' -LogPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1600711735-dcb2017c-f366-4915-b1e2-402c1ba6dd991600711712286\EditorServices.log' -SessionDetailsPath 'c:\Users\Wuser.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-3096-381252' -FeatureFlags @() 21/09/2020 20:08:55 [NORMAL] - powershell.exe started. 21/09/2020 20:08:55 [NORMAL] - Waiting for session file 21/09/2020 20:12:56 [NORMAL] - Timed out waiting for session file to appear. 21/09/2020 20:12:56 [NORMAL] - Language server startup failed. 21/09/2020 20:12:56 [ERROR] - The language service could not be started: 21/09/2020 20:12:56 [ERROR] - Error: Timed out waiting for session file to appear.

TylerLeonhardt commented 4 years ago

@H1-N1 what version of the .NET Framework do you have installed? I think this will be fixed if you install v4.6 or higher.

rjmholt commented 4 years ago

Can you let us know the output of this:

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\'
rjmholt commented 4 years ago

For reference, we throw here and need to ensure net452 can run until here to get a clean message.

H1-N1 commented 3 years ago

install .NET Framework v4.6 or higher

sunilram-net commented 3 years ago

Can you let us know the output of this:

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\'

CBS : 1 Install : 1 InstallPath : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ Release : 528372 Servicing : 0 TargetVersion : 4.0.0 Version : 4.8.04084 PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\ PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4 PSChildName : Full PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry