vscode-powershell: Extension crashes with ParseError: The '<' operator is reserved for future use

Issue Description

Whenever I open a PowerShell file (ps1 / psm1) the extension crashes like so:

vscode-powershell-crash vscode-powershell-error vscode-powershell-session-error image

I tried the following to no effect:

  • uninstall + reinstall
  • preview version
  • Restart vscode
  • Restart computer

Attached Logs

6/23/2020 5:30:07 PM [NORMAL] - Visual Studio Code v1.46.1 64-bit
6/23/2020 5:30:07 PM [NORMAL] - PowerShell Extension v2020.6.0
6/23/2020 5:30:07 PM [NORMAL] - Operating System: Windows 64-bit
6/23/2020 5:30:07 PM [NORMAL] - Language server starting --
6/23/2020 5:30:07 PM [NORMAL] -     PowerShell executable: C:\Users\ohad1\.dotnet\tools\pwsh.exe
6/23/2020 5:30:07 PM [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\ohad1\.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\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1592922607-427b8a15-52cc-47ce-b42c-273cfda30f671592922585773\EditorServices.log' -SessionDetailsPath 'c:\Users\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-22388-563996' -FeatureFlags @() 
6/23/2020 5:30:07 PM [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\ohad1\.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\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1592922607-427b8a15-52cc-47ce-b42c-273cfda30f671592922585773\EditorServices.log' -SessionDetailsPath 'c:\Users\ohad1\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-22388-563996' -FeatureFlags @() 
6/23/2020 5:30:07 PM [NORMAL] - pwsh.exe started.
6/23/2020 5:30:07 PM [NORMAL] - Waiting for session file
6/23/2020 5:34:08 PM [NORMAL] - Timed out waiting for session file to appear.
6/23/2020 5:34:08 PM [NORMAL] - Language server startup failed.
6/23/2020 5:34:08 PM [ERROR] - The language service could not be started: 
6/23/2020 5:34:08 PM [ERROR] - Error: Timed out waiting for session file to appear.

It looks like the < in the StartupBanner is causing the issue

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18363
VSCode 1.46.1
PowerShell Extension Version 2020.6.0

PowerShell Information

PS C:\> $psEditor.EditorServicesVersion
PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

I don’t know why 5.1 is loaded - I have the latest PowerShell Core (7.0.02) installed and working (e.g. in Windows Terminal).

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
azure-account ms-vscode 0.8.11
azurerm-vscode-tools msazurermtools 0.11.0
ginfuru-vscode-jekyll-syntax ginfuru 0.1.1
html-preview-vscode tht13 0.2.5
language-liquid neilding 0.1.1
mssql ms-mssql 1.9.0
powershell ms-vscode 2020.6.0
remote-wsl ms-vscode-remote 0.44.4
team ms-vsts 1.161.0
vscode-aks-tools ms-kubernetes-tools 0.0.6
vscode-docker ms-azuretools 1.3.1
vscode-dotnet-runtime ms-dotnettools 0.1.2
vscode-kubernetes-tools ms-kubernetes-tools 1.2.1
vscode-yaml redhat 0.8.0
xml DotJoshJohnson 2.5.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Thanks, I can confirm .NET tool uninstall + install regular PS MSI works! Sure is good enough for me, but I do like the global tool approach because it’s basically a package manager - not crazy about going off to download MSIs every time a new version comes out… When WinGet is GA I guess that won’t be an issue though (assuming this behavior doesn’t reproduce there of course).

As for my setup, pretty straightforward - display language is English, preferred language it English (I do have Hebrew installed alongside it but it never caused any issue AFAIK). English keyboard layout is standard US QWERTY…

@andschwa looks good, thanks!

I’m able to reproduce this issue. I’ll see if I can take a look at some point. Currently working on several things already, but hopefully I can find some time this week

@TylerLeonhardt the setting is: powershell.integratedConsole.suppressStartupBanner setting this to true does skip the error:

But the extension then proceeds with another series of unclear errors (the script executes fine outside VS Code):

Clear-Host: E:\Projects\xyz\acme\build\update-script.ps1:30:1
Line |
  30 | Clear-Host; 
     | ~~~~~~~~~~ 
     | The term 'Clear-Host' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path 
     | was included, verify that the path is correct and try again.

Does that mean I need to uninstall the .NET global tool and install the “regular” MSI package?

This seems likely at this point… can you give it a try?

I’d like to get to the bottom of why the Global Tool isn’t working for you… is your computer’s language set to something that isn’t english? Do you use a different keyboard layout? (just shots in the dark… I should probably go try the global tool myself…)

FWIW, the MSI is faster than the Global Tool so frankly I recommend the MSI anyway.