Skip to content

Extension crashes with ParseError: The '<' operator is reserved for future use #2780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ohadschn opened this issue Jun 23, 2020 · 20 comments · Fixed by #2788
Closed

Extension crashes with ParseError: The '<' operator is reserved for future use #2780

ohadschn opened this issue Jun 23, 2020 · 20 comments · Fixed by #2788
Labels

Comments

@ohadschn
Copy link

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
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jun 23, 2020
@TylerLeonhardt
Copy link
Member

PowerShell executable: C:\Users\ohad1.dotnet\tools\pwsh.exe

From your logs it looks like you're using the .NET Global Tool. What version of the .NET Global Tool do you have installed?

PS>  C:\Users\ohad1\.dotnet\tools\pwsh.exe
PS> $PSVersionTable

@ohadschn
Copy link
Author

ohadschn commented Jun 23, 2020

Correct, here's the output from C:\Users\ohad1\.dotnet\tools\pwsh.exe:

$PSVersionTable

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

@SydneyhSmith
Copy link
Collaborator

Thanks @ohadschn does this reproduce if you use another version of PowerShell rather than the dot net global tool, to set your default PowerShell version use:
"powershell.powerShellDefaultVersion": "PowerShell Preview (x64)",

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Jun 23, 2020
@ohadschn
Copy link
Author

Thanks @ohadschn does this reproduce if you use another version of PowerShell rather than the dot net global tool, to set your default PowerShell version use:
"powershell.powerShellDefaultVersion": "PowerShell Preview (x64)",

Thank you, unfortunately it still reproduces with that setting (restarted vscode)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 24, 2020
@SydneyhSmith
Copy link
Collaborator

Thanks @ohadschn sorry to hear that this issue is still reproducing, what installation method did you use for PowerShell preview?

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 25, 2020
@ohadschn
Copy link
Author

I'm not sure I follow, I don't have PowerShell preview installed as far as I know.
Did you mean for it to install it and then try "powershell.powerShellDefaultVersion": "PowerShell Preview (x64)"?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 25, 2020
@SydneyhSmith
Copy link
Collaborator

@ohadschn sorry that was totally my bad, I forgot to update the snippet I sent you, that would work (ie. installing PowerShell preview first) or if you are running on Windows you could instead try:
"powershell.powerShellDefaultVersion": "Windows PowerShell (x64)"

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 25, 2020
@ohadschn
Copy link
Author

ohadschn commented Jun 25, 2020

No worries, I definitely share the blame for blindly copy-pasting. I am indeed running on Windows, and the new setting ("powershell.powerShellDefaultVersion": "Windows PowerShell (x64)") seems to do the trick! (that is all errors are gone)

However that gives me PS 5.1 while I need PS Core (7), and reverting the above config change unfortunately reproduces the problem... Does that mean I need to uninstall the .NET global tool and install the "regular" MSI package?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 25, 2020
@TylerLeonhardt
Copy link
Member

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.

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 26, 2020
@ohadschn
Copy link
Author

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...

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 26, 2020
@TylerLeonhardt
Copy link
Member

Cc @adityapatwardhan about global tool.

@ohadschn There's also a setting to suppress the startup banner... I wonder if that would fix the issue. I have doubt, but it might. Not sure what it is off the top of my head.

@JosKrause
Copy link

JosKrause commented Jun 27, 2020

@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.

@JosKrause
Copy link

JosKrause commented Jun 27, 2020

(I seemingly cannot add a newline after a code block in my previous comment)

@TylerLeonhardt as an update, when I downgrade to v2020.1.0 of the extension my script runs fine in VS Code, any update after that breaks and gives me that Clear-Host error regardless of supressing the banner.

Edit: I have PS 7.0.2 installed through the MSI on Github, as well as the Global Tool 7.0.2.

@rjmholt
Copy link
Contributor

rjmholt commented Jun 30, 2020

any update after that breaks and gives me that Clear-Host error regardless of suppressing the banner.

This is strange. It sounds like needed modules might not be imported. Perhaps your profile sets the PSModulePath?

The banner issue looks like the argument to set the banner hasn't been quoted/escaped properly. If this is dotnet global tool specific, then it may be due to dotnet having some expectation about how parameters are passed. There are several layers to pass parameters through there and this gets pretty dicey.

@rjmholt
Copy link
Contributor

rjmholt commented Jun 30, 2020

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

@rjmholt rjmholt self-assigned this Jun 30, 2020
@rjmholt rjmholt added Area-Startup Issue-Bug A bug to squash. and removed Needs-Repro-Info Needs: Maintainer Attention Maintainer attention needed! labels Jun 30, 2020
@JosKrause
Copy link

JosKrause commented Jul 1, 2020

This is strange. It sounds like needed modules might not be imported. Perhaps your profile sets the PSModulePath?

If I start the extension with load profile disabled (powershell.enableProfileLoading: false) it still occurs. I can figure out though where the files are located and see what is happening there.

@eddie-zalar
Copy link

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

@JosKrause
Thank you very much! After searching ~2 hours, that setting removed the issue that the language server can not start!
By the way: I used this version of powershell core as a dotnet global tool:
Name Value


PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

And the v2020.6.0 of the PowerShell extension.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 19, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Dec 8, 2020
@ohadschn
Copy link
Author

@rjmholt could you re-open this? I'm seeing what appears to be the same issue using the latest extension (v2020.6.0) and PS Core 7.1.1 installed as a global tool (setting suppressStartupBanner to true resolves the issue).

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 10, 2021
@andyleejordan
Copy link
Member

@ohadschn Try PowerShell 7.1.3, we don't think the fix was in 7.1.1.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 14, 2021
@ohadschn
Copy link
Author

@andschwa looks good, thanks!

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 14, 2021
@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants