Repository navigation
Closed
PowerShell/PowerShellEditorServices
#1864Description
ATTN: Christoph Bergmeister (@bergmeister) TylerLeonhardt
Moved from: #2696 (comment)
Issue also reproduced by Przemysław Kłys (@PrzemyslawKlys)
Issue Description
If you have an older version of PSScriptAnalyzer (1.18.* in my case) in your modules folder and have not updated to the latest, this is taking precedence and the assemblies for this are loading in the integrated terminal, rather than the "bundled" vscode one. This prevented for instance parameter casing "format document" from working correctly until I deleted my "modules" version of PSSA and reloading, then it worked fine.
Potential Remediations
- Adjust loading process to prioritize either "latest version regardless" or "bundled extension"
- Use AssemblyLoadContext to load PSScriptAnalyzer to not expose it to integrated terminal
Attached Logs
Follow the instructions in the README about
capturing and sending logs.
Environment Information
Visual Studio Code
| Name | Version |
|---|---|
| Operating System | Windows_NT x64 10.0.19041 |
| VSCode | 1.46.0-insider |
| PowerShell Extension Version | 2020.5.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 |
|---|---|---|
| azure-account | ms-vscode | 0.8.11 |
| azure-pipelines | ms-azure-devops | 1.165.1 |
| better-align | wwm | 1.1.6 |
| better-powershell-syntax-highlighting | justin-grote | 0.0.2 |
| bracket-pair-colorizer-2 | CoenraadS | 0.1.3 |
| gistfs | vsls-contrib | 0.0.67 |
| git-graph | mhutchie | 1.22.0 |
| gitdoc | vsls-contrib | 0.0.6 |
| gitlens | eamodio | 10.2.1 |
| indent-rainbow | oderwat | 7.4.0 |
| markdown-all-in-one | yzhang | 2.8.0 |
| powershell-preview | ms-vscode | 2020.5.0 |
| remote-containers | ms-vscode-remote | 0.117.1 |
| remote-ssh-edit-nightly | ms-vscode-remote | 2020.4.9540 |
| remote-ssh-nightly | ms-vscode-remote | 2020.4.9540 |
| remote-wsl | ms-vscode-remote | 0.44.2 |
| todo-tree | Gruntfuggly | 0.0.174 |
| vscode-icons | vscode-icons-team | 10.1.1 |
| vscode-peacock | johnpapa | 3.7.2 |
| vscode-pull-request-github | GitHub | 0.16.0 |
| vscode-sort-json | richie5um2 | 1.18.0 |
| vscode-yaml | redhat | 0.8.0 |
| vscode-zipexplorer | slevesque | 0.3.1 |
| vsonline | ms-vsonline | 1.0.2167 |
Reacted by Ben Gelens
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone

Activity
bergmeister commentedon May 13, 2020
In my experience, if PSSA is installed AND of higher version, then it will and should take precedence.
But if the version is lower then in your case, then it sounded a bit unexpected at first. However, thinking about it again, module loading is determined by the
PSModulePathenvironment variable. I cannot remember if it goes through all modules and picks the highest one or stops on the first module it finds. If the latter is the case then this is actually by design. Can you clarify Rob Holt (@rjmholt) TylerLeonhardt ?rjmholt commentedon May 13, 2020
It should use the highest version on the module path
SydneyhSmith commentedon May 14, 2020
Thanks Justin Grote (@JustinGrote) that is unexpected behavior...it would be interesting to also see the output of
Get-Module PSScriptAnalyzer -ListAvailablePrzemyslawKlys commentedon May 14, 2020
If you have 1.19.0 installed as module outside of VSCode it will take precedence.
TylerLeonhardt commentedon May 14, 2020
Can you all run this in the PowerShell Integrated Console:
You should get back one of them that has PSSA imported. That will give us the version that's actually being used.
JustinGrote commentedon May 14, 2020
This is on a fresh reload of vscode, only thing that would have run is my profile (and there's no PSSA related loading stuff in there). Tried without profile same result.
rkeithhill commentedon May 14, 2020
Would it be possible to name the runspace we use for PSSA?
rjmholt commentedon May 14, 2020
It depends. There are some places where we use a runspace pool, and PSSA uses its own runspace pool as well
TylerLeonhardt commentedon May 15, 2020
weird it didn't work for you Justin Grote (@JustinGrote)... maybe it's a Windows/macOS difference...
9 remaining items
andyleejordan commentedon Aug 19, 2021
Hm, I'm going to re-open this. For PSReadLine we decided to specifically only load the bundled copy of the module, and when we pull in the upcoming PSScriptAnalyzer release (v1.20.0) I would like to change the logic to match. There are too many potential pitfalls when PSES is allowed to just import anything on the system.
[-][PSScriptAnalyzer] Locally Installed Module Takes Precedence over Extension-Bundled one[/-][+]Locally installed PSScriptAnalyzer module takes precedence over bundled one[/+]