-
Notifications
You must be signed in to change notification settings - Fork 392
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
Invoke-ScriptAnalyzer: An item with the same key has already been added. What is the proper syntax? #1511
Comments
Can repro with PSSA 1.19.0 on PS 7 on Windows. Also happens with the current version of PSSA on master. |
Would you be able to collect the full error print out with |
I've got it in the debugger already, it's happening here:
Fix should be trivial, .Net 4.5.2 doesn't contain the .TryAdd method unfortuantely.
if (!variableDictionary.ContainsKey(variableName))
{
variableDictionary.Add(variableName, variable);
} I've opened a draft PR for it already, just need to write a regression test. |
Agreed. |
@jantari A hang is unexpected and might be a different issue, can you provide more details please? |
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.... |
I'm in favour of a 1.19.1 release |
Hey, @rjmholt, is there a schedule for a 1.19.1 release, by any chance? |
Best to ask @JamesWTruher and @SydneyhSmith |
@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. As far as I'm concerned, this can be closed. EDIT: nvm it was closed all along |
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
Code
Command
Expected Output
none
Actual Output
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 :)
Thanks!
The text was updated successfully, but these errors were encountered: