You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invoke-ScriptAnalyzer: An item with the same key has already been added. What is the proper syntax? #1511
I seem to be receiving a rule-less error whenever running PSScriptAnalyzer with default settings against a PowerShell script containing the following code block.
Environment
MacOS 10.15.4
PowerShell 7 LTS for MacOS
PSScriptAnalyzer 1.19.0
Invoke-ScriptAnalyzer: An item with the same key has already been added. Key: output
Question
What is the proper PowerShell syntax to prevent this error from generating? Or, which Rule can I ignore to suppress it? The code executes fine, just for the record :)
jantari A hang is unexpected and might be a different issue, can you provide more details please?
For the moment, we suggest to pin the version of PSScriptAnalyzer using the -MaximumVersion 1.18.3 parameter on Install-Module?
What do you think about a 1.19.1 release James Truher (@JamesWTruher)Rob Holt (@rjmholt) ? If, so then I'd like to have PR #1497 and optionally #1491 considered as well.
I am also seeing this issue, it seems to only affect scripts with hash tables that have duplicates in them. I've pinned to version 1.18.3 and get the error, which breaks my pester tests. like above. I also have tried pinning to 1.91.1 this throws the error still but the pester step in my build finishes without error, sans any testing it would otherwise do....
Thomas Rayner (@thomasrayner) currently we are targeting a 1.19.1 release in about two weeks (likely the last week in July) however this is truly not a promise/commitment--just a good faith estimate....we are hoping to get another bug fix into this release, and then prioritize the release amongst other commitments
I wanted to say that during some general CI maintenance I switched to using 1.19.1/latest again and my deadlock is not occuring anymore, so appears fixed.
Activity
bergmeister commentedon May 22, 2020
Can repro with PSSA 1.19.0 on PS 7 on Windows. Also happens with the current version of PSSA on master.
rjmholt commentedon May 22, 2020
Would you be able to collect the full error print out with
Get-Errorand posting it here -- in particular the stack trace is importantbergmeister commentedon May 22, 2020
I've got it in the debugger already, it's happening here:
PSScriptAnalyzer/Rules/UseUsingScopeModifierInNewRunspaces.cs
Line 220 in f9661f9
Fix should be trivial, .Net 4.5.2 doesn't contain the
.TryAddmethod unfortuantely.I've opened a draft PR for it already, just need to write a regression test.
bergmeister commentedon May 22, 2020
Actually, my fork didn't have the last 3 commits, this issue was already fixed in PR #1493 and is effectively a duplicate of #1492
jantari commentedon May 28, 2020
Hello.
This critical bug is causing all my GitHub Actions CI that use PSScriptAnalyzer to hang indefinitely.

See screenshot:
And then it never does anything - doesn't quit either. I've had these running for over 45 minutes.
Using the
ubuntu-latestrunner with fresh PSSA installs from PSGallery every time.Since this is such a severe bug, when can we expect a point release with the fix?
Thanks
RylandDeGregory commentedon May 28, 2020
Agreed.
bergmeister commentedon May 28, 2020
jantari A hang is unexpected and might be a different issue, can you provide more details please?
For the moment, we suggest to pin the version of PSScriptAnalyzer using the
-MaximumVersion 1.18.3parameter onInstall-Module?What do you think about a
1.19.1release James Truher (@JamesWTruher) Rob Holt (@rjmholt) ? If, so then I'd like to have PR #1497 and optionally #1491 considered as well.DigitalNightmare commentedon May 30, 2020
I am also seeing this issue, it seems to only affect scripts with hash tables that have duplicates in them. I've pinned to version 1.18.3 and get the error, which breaks my pester tests. like above. I also have tried pinning to 1.91.1 this throws the error still but the pester step in my build finishes without error, sans any testing it would otherwise do....
rjmholt commentedon Jun 29, 2020
I'm in favour of a 1.19.1 release
thomasrayner commentedon Jul 16, 2020
Hey, Rob Holt (@rjmholt), is there a schedule for a 1.19.1 release, by any chance?
rjmholt commentedon Jul 16, 2020
Best to ask James Truher (@JamesWTruher) and Sydney Smith (@SydneyhSmith)
SydneyhSmith commentedon Jul 16, 2020
Thomas Rayner (@thomasrayner) currently we are targeting a 1.19.1 release in about two weeks (likely the last week in July) however this is truly not a promise/commitment--just a good faith estimate....we are hoping to get another bug fix into this release, and then prioritize the release amongst other commitments
jantari commentedon Oct 23, 2020
I wanted to say that during some general CI maintenance I switched to using 1.19.1/latest again and my deadlock is not occuring anymore, so appears fixed.
As far as I'm concerned, this can be closed.
EDIT: nvm it was closed all along