Skip to content

Running "Set PSScriptAnalyzer Rules" on an untitled file causes PSES to crash #1155

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
jkavanagh58 opened this issue Jan 8, 2018 · 5 comments
Labels
Issue-Bug A bug to squash.

Comments

@jkavanagh58
Copy link

Issue Description

I am experiencing a problem with selecting PSScriptAnalyzer Rules. I add individual elements and then press confirm. After a brief delay the PowerShell session terminates and I prompted to restart or close. I have read similar issues where it was closed but this is consistent for me.
Now I receive "command 'PowerShell.SelectPSSARules' not found"

Attached Logs

Follow the instructions in the README about capturing and sending logs.

psscriptanlyzertermshell.zip

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.15063
VSCode 1.19.1
PowerShell Extension Version 1.5.1

PowerShell Information

Name Value
PSVersion 5.1.15063.726
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.15063.726
BuildVersion 10.0.15063.726
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
azure-account ms-vscode 0.2.2
beautify HookyQR 1.1.1
gitlens eamodio 7.2.0
Material-theme zhuangtongfa 2.11.1
PowerShell ms-vscode 1.5.1
team ms-vsts 1.122.0
Theme-Blackboard gerane 0.0.2
vscode-insertdatestring jsynowiec 2.2.0
vscode-PSStackoverflow DougFinke 0.0.2
vscode-todo-highlight wayou 0.5.11
vscode-todo-plus fabiospampinato 1.7.2
vscode-wakatime WakaTime 1.1.22
WeatherExtension AndrewMoll 0.1.3
xml DotJoshJohnson 1.9.2
@jkavanagh58
Copy link
Author

Forget the Now I receive "command 'PowerShell.SelectPSSARules' not found"; I was not in a ps1 editor session.

@rkeithhill
Copy link
Contributor

Thanks for reporting this. I see what the issue is. As a work-around do not set PSSA rules when you have an unsaved i.e. an Untitled-<n> file open. Save the file or open a PS1 file and then set the PSSA rules.

@jkavanagh58
Copy link
Author

Outstanding, I was using a New File for testing the rules... thank you very much.

@daviwil
Copy link
Contributor

daviwil commented Jan 12, 2018

Reopening since there's a legitmate bug here! Thanks for the report @jkavanagh58

@daviwil daviwil reopened this Jan 12, 2018
@daviwil daviwil changed the title PSScriptAnalyzer add Rules Running "Set PSScriptAnalyzer Rules" on an untitled file causes PSES to crash Jan 12, 2018
rkeithhill added a commit that referenced this issue Mar 24, 2018
If you use fsPath you get a path of "Untitled-1" which doesn't work
with PSES IsInMemory method.

Fix #1155 where selecting PSSA rules in Untitled-1 file crashes PSES.
@rkeithhill
Copy link
Contributor

OK, I think I've fixed this a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants