vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

New 'PowerShell Extension Terminal' does not work with pwsh.

Open alcarsa5 opened this issue 3 years ago • 5 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all open and closed issues to ensure it has not already been reported.
  • [ ] I have read the troubleshooting guide.
  • [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • [ ] If this is a security issue, I have read the security issue reporting guidance.

Summary

PowerShell Terminal crashes when PowerShell Core is installed. Without PowerShell Core, using version 5.1.20348.643, it opens normally.

PowerShell Version

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

Visual Studio Code Version

1.70.0
da76f93349a72022ca4670c1b84860304616aaa2
x64

Extension Version

[email protected]

Steps to Reproduce

  1. Install PowerShell Core: dotnet tool install -g powershell.
  2. Open VS Code.
  3. Open a PowerShell Terminal inside VS Code.

Visuals

No response

Logs

PowerShell terminal: Start-EditorServices: A positional parameter cannot be found that accepts argument 'Extension'.

Floating window: The terminal process "C:\Users\myUser.dotnet\tools\pwsh.exe '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\myUser.vscode\extensions\ms-vscode.powershell-2022.7.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.7.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\myUser.vscode\extensions\ms-vscode.powershell-2022.7.2\modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2022.7.2 Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell Type 'help' to get help. " -LogLevel 'Normal' -LogPath 'c:\Users\myUser\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1659685232-9fc8272f-70bf-4533-9dea-97ca56801ead1659685205257\EditorServices.log' -SessionDetailsPath 'c:\Users\myUser\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-19184-566382.json' -FeatureFlags @() '" terminated with exit code: 1.

alcarsa5 avatar Aug 05 '22 12:08 alcarsa5

@SeeminglyScience any idea here? My instinct says it's acting like there's an issue with the multi-line startup banner string, as that's the only thing with the word "Extension" in it.

andyleejordan avatar Aug 05 '22 15:08 andyleejordan

Looks like a problem with the dotnet global tool install of PowerShell. Unsure if it's us or if the way args are passed to it is a little wonky on the dotnet side.

In the mean time @alcarsa5 I'd highly recommend just installing the .msi version instead.

SeeminglyScience avatar Aug 05 '22 18:08 SeeminglyScience

Thanks for the idea. Nevertheless, I found easier to use previous version of VS Code extension, which has no problems with pwsh. I hope you can found the cause soon :).

ghost avatar Aug 08 '22 09:08 ghost

The same thing happens to us in our company. Please see if you can prioritize fixing this issue.

Suriman avatar Aug 08 '22 09:08 Suriman

Hi there, I can take a look at disabling the startup banner if we detect that we're using this dotnet install of PowerShell. Meanwhile, you can simply disable the startup banner itself:

"powershell.integratedConsole.suppressStartupBanner": true

andyleejordan avatar Aug 08 '22 21:08 andyleejordan