PowerShell Preview Extension v2019.5.0 Error Starting Language Services
Issue Description
The PowerShell Preview Extension v2019.5.0 fails to load on Windows Server 2016 with .NET Framework version 4.6.2 installed with the following error:
An error occurred while starting PowerShell Editor Services:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)
at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
The log output is:
6/13/2019 5:13:27 PM [NORMAL] - Visual Studio Code v1.35.1 64-bit
6/13/2019 5:13:27 PM [NORMAL] - PowerShell Extension v2019.5.0
6/13/2019 5:13:27 PM [NORMAL] - Operating System: Windows 64-bit
6/13/2019 5:13:27 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
6/13/2019 5:13:27 PM [NORMAL] - Language server starting --
6/13/2019 5:13:27 PM [NORMAL] - exe: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
6/13/2019 5:13:27 PM [NORMAL] - args: C:\Users\steel.28a\.vscode\extensions\ms-vscode.powershell-preview-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\steel.28a\.vscode\extensions\ms-vscode.powershell-preview-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\steel.28a\.vscode\extensions\ms-vscode.powershell-preview-2019.5.0\logs\1560460407-f980c647-68f0-44a2-804d-2329acb26ab11560460398815\EditorServices.log' -SessionDetailsPath 'C:\Users\steel.28a\.vscode\extensions\ms-vscode.powershell-preview-2019.5.0\sessions\PSES-VSCode-27624-220671' -FeatureFlags @('PSReadLine')
6/13/2019 5:13:28 PM [NORMAL] - powershell.exe started, pid: 16996
6/13/2019 5:15:28 PM [NORMAL] - Language server startup failed.
6/13/2019 5:15:28 PM [ERROR] - The language service could not be started:
6/13/2019 5:15:28 PM [ERROR] - Timed out waiting for session file to appear.
6/13/2019 5:18:30 PM [NORMAL] - powershell.exe terminated or terminal UI was closed```
This seems to be similar to #1841
I suspect there is a dependency of > .NET 4.7.x, given another Server 2016 system I work on had this same issue with the in-box .NET 4.6.2 until I installed .NET 4.7.2. If this is the case, it would be nice to have this mentioned in the extension's "Details" (perhaps in "Platform support" or install instructions) if not somehow accounted for in Dependencies.
PS C:\Users\steel.28a> Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name Release | Select-Object -Property PSPath, Release
PSPath Release
------ -------
Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full 394802
Attached Logs
Environment Information
Visual Studio Code
| Name | Version |
|---|---|
| Operating System | Windows_NT x64 10.0.14393 |
| VSCode | 1.35.1 |
| PowerShell Extension Version | 2019.5.0 |
PowerShell Information
| Name | Value |
|---|---|
| PSVersion | 5.1.14393.2969 |
| PSEdition | Desktop |
| PSCompatibleVersions | 1.0 2.0 3.0 4.0 5.0 5.1.14393.2969 |
| BuildVersion | 10.0.14393.2969 |
| CLRVersion | 4.0.30319.42000 |
| WSManStackVersion | 3.0 |
| PSRemotingProtocolVersion | 2.3 |
| SerializationVersion | 1.1.0.1 |
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
| Extension | Author | Version |
|---|---|---|
| powershell-preview | ms-vscode | 2019.5.0 |
Thanks for opening an issue @brycesteel. I think your diagnosis is pretty accurate. ~~This may actually be a PowerShellStandard bug.~~ This appears to be an issue in the way we use .NET Standard.
If you go to ~/.vscode/extensions/ms-vscode.powershell-preview-2019.5.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 you might be able to insert a Wait-Debugger and capture the LoaderExceptions output.
Otherwise it might appear in the fusion log.
If either of those show you useful information, can you please post it here.
Installing 4.7.2 resolved this issue for me
/cc @JamesWTruher
This should be fixed now (by https://github.com/PowerShell/PowerShellEditorServices/pull/1151). Could you let me know if you're still experiencing this.