PowerShell / PowerShell/vscode-powershell

Extension crashes when formating

Open
#2,027 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Code Formatting Area-Script Analysis
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Issue Description

Whenever I try to format code, either from the context menu or via Ctrl-K Ctrl-F, the extension crashes, even on a file only containing "Import-Module ActiveDirectory". The log contains an entry "Exception: PSScriptAnalyzer cannot be imported, AnalysisService will be disabled", should I be installing that or is it expected to be installed by the extension?

Attached Logs

EditorServices.log
vscode-powershell.log

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 6.3.9600
VSCode 1.35.1
PowerShell Extension Version 2019.5.0

PowerShell Information

Name Value
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.19170
PSCompatibleVersions 1.0 2.0 3.0 4.0
PSRemotingProtocolVersion 2.2

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
gitlens eamodio 9.8.2
powershell ms-vscode 2019.5.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing formatting from the context menu and with Ctrl-K Ctrl-F on the reported Windows, VS Code, extension, and PowerShell versions. Inspect EditorServices.log and vscode-powershell.log for the crash and PSScriptAnalyzer import failure; the issue is done when formatting completes without crashing and the underlying failure is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.