-
Notifications
You must be signed in to change notification settings - Fork 499
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
Locally installed PSScriptAnalyzer module takes precedence over bundled one #2697
Locally installed PSScriptAnalyzer module takes precedence over bundled one #2697
Comments
In my experience, if PSSA is installed AND of higher version, then it will and should take precedence. |
Thanks @JustinGrote that is unexpected behavior...it would be interesting to also see the output of |
Can you all run this in the PowerShell Integrated Console: Get-Runspace | % {
$_.Name
try {
[PowerShell]::Create($_).AddCommand("gmo").Invoke()
} catch {
"Failed which is ok"
}
} You should get back one of them that has PSSA imported. That will give us the version that's actually being used. |
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.
|
Would it be possible to name the runspace we use for PSSA? |
It depends. There are some places where we use a runspace pool, and PSSA uses its own runspace pool as well |
weird it didn't work for you @JustinGrote... maybe it's a Windows/macOS difference... |
@JustinGrote what's the output of |
|
@PrzemyslawKlys thanks for the additional info, unfortunately that's a slightly different issue--the way Import-Module works (if no version parameters are used) is that it imports the first version of the module found on the module path (rather than searching all paths and importing the latest one), in the case of how the PowerShell extension imports PSSA we specifically search for the latest version |
This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information! |
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. |
ATTN: @bergmeister @TylerLeonhardt
Moved from: #2696 (comment)
Issue also reproduced by @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.
This is on a "fresh" load:
Potential Remediations
Attached Logs
Follow the instructions in the README about
capturing and sending logs.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: