Skip to content

[Preview] [PSES] Clear-Host Error Recorded in PSES Log for Powershell 5.1 #2379

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
JustinGrote opened this issue Dec 19, 2019 · 4 comments · Fixed by PowerShell/PowerShellEditorServices#1138

Comments

@JustinGrote
Copy link
Collaborator

Issue Description

@TylerLeonhardt
Likely related to #2316, There is a startup error that occurs with PS5.1. Not observed with 6 or 7

Attached Logs

[Info  - 8:53:04 AM] PowerShell runtime version: 5.1.19041.1, edition: Desktop
[Info  - 8:53:04 AM] highlight handler loaded
[Error - 8:53:04 AM] Execution of the following command(s) completed with errors:

    Import-Module C:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\Commands\PowerShellEditorServices.Commands.psd1

Error #1:
The AllScope option cannot be removed from the alias 'clear'.
ScriptStackTrace:
at <ScriptBlock>, C:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\Commands\Public\Clear-Host.ps1: line 17
at <ScriptBlock>, C:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\Commands\PowerShellEditorServices.Commands.psm1: line 9
at <ScriptBlock>, C:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\Commands\PowerShellEditorServices.Commands.psm1: line 8
Exception:
   System.Management.Automation.SessionStateUnauthorizedAccessException: The AllScope option cannot be removed from the alias 'clear'.
   at System.Management.Automation.SessionStateScope.SetAliasItem(AliasInfo aliasToSet, Boolean force, CommandOrigin origin)
   at Microsoft.PowerShell.Commands.SetAliasCommand.ProcessRecord()

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19041
VSCode 1.42.0-insider
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
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
better-align wwm 1.1.6
better-comments aaron-bond 2.0.5
better-powershell-syntax-highlighting justin-grote 0.0.2
bracket-pair-colorizer-2 CoenraadS 0.0.29
code-settings-sync Shan 3.4.3
gc-excelviewer GrapeCity 2.1.32
gistfs vsls-contrib 0.0.22
git-graph mhutchie 1.19.1
gitlens eamodio 10.2.0
indent-rainbow oderwat 7.4.0
markdown-all-in-one yzhang 2.6.1
powershell-preview ms-vscode 2019.12.0
remote-containers ms-vscode-remote 0.96.0
remote-ssh-edit-nightly ms-vscode-remote 2019.12.24000
remote-ssh-nightly ms-vscode-remote 2019.12.24000
remote-wsl ms-vscode-remote 0.41.6
todo-tree Gruntfuggly 0.0.162
vscode-icons vscode-icons-team 9.6.0
vscode-peacock johnpapa 3.2.0
vscode-sort-json richie5um2 1.18.0
vscode-zipexplorer slevesque 0.3.1
@ghost ghost added the Needs: Triage Maintainer attention needed! label Dec 19, 2019
@TylerLeonhardt
Copy link
Member

Does this prevent the extension from working at all?

@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 19, 2019

@TylerLeonhardt no, appears to just be cosmetic at the moment, this would be low priority. Just something I noticed :)

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Dec 19, 2019

That's good at least... I think in this case, we want to just add an -Option AllScope to https://github.com/PowerShell/PowerShellEditorServices/blob/master/module/PowerShellEditorServices/Commands/Public/Clear-Host.ps1#L17

...as long as Windows PowerShell is fine with that...

@SydneyhSmith
Copy link
Collaborator

@TylerLeonhardt and I tried this out earlier today and it looks like adding -Option AllScope worked as a fix...thanks for opening this issue @JustinGrote

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants