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
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
$error[0] | Select-Object *
writeErrorStream : True
PSMessageDetails :
Exception : System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.FindVarsInAssignmentAsts(Ast ast) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.AnalyzeScriptBlock(ScriptBlockExpressionAst scriptBlockExpressio nAst) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.VisitScriptBlockExpression(ScriptBlockExpressionAst scriptBlockE xpressionAst) at System.Management.Automation.Language.ScriptBlockExpressionAst.InternalVisit(AstVisitor v isitor) at System.Management.Automation.Language.CommandAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.PipelineAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.StatementBlockAst.InternalVisit(AstVisitor visitor, ReadOnlyCollection1 traps, ReadOnlyCollection`1 statements, AstVisitAction action)
at System.Management.Automation.Language.NamedBlockAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.ScriptBlockAst.InternalVisit(AstVisitor visitor)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa
ces.AnalyzeScript(Ast ast, String fileName)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.<>c__DisplayClass83_1.b__2()
TargetObject : D:\GitLab-Runner\builds\armEq4Je\0\xxxx\xxxx-managed-scripts\Infra\roles\role_check_server_sanity\files\Script\dummy.ps1
CategoryInfo : InvalidOperation: (D:\GitLab-Runne...dummy.ps1:String) [Invoke-ScriptAnalyzer], ArgumentE
xception
FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace :
PipelineIterationInfo : {0, 1, 0}
Thanks for the effort of reporting the bug. I can reproduce with 1.19.0 but I am happy to say we have fixed this already in master in PR #1493. We hope to release 1.19.1 in the next weeks.
Before submitting a bug report:
Steps to reproduce
ran:
Invoke-ScriptAnalyzer -Path .\dummy.ps1 -Recurse -Severity 'warning' -Verbose
dummy.ps1
Expected behavior
Actual behavior
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
$error[0] | Select-Object *
writeErrorStream : True
PSMessageDetails :
Exception : System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.FindVarsInAssignmentAsts(Ast ast) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.AnalyzeScriptBlock(ScriptBlockExpressionAst scriptBlockExpressio nAst) at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa ces.SyntaxCompatibilityVisitor.VisitScriptBlockExpression(ScriptBlockExpressionAst scriptBlockE xpressionAst) at System.Management.Automation.Language.ScriptBlockExpressionAst.InternalVisit(AstVisitor v isitor) at System.Management.Automation.Language.CommandAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.PipelineAst.InternalVisit(AstVisitor visitor) at System.Management.Automation.Language.StatementBlockAst.InternalVisit(AstVisitor visitor, ReadOnlyCollection
1 traps, ReadOnlyCollection`1 statements, AstVisitAction action)at System.Management.Automation.Language.NamedBlockAst.InternalVisit(AstVisitor visitor)
at System.Management.Automation.Language.ScriptBlockAst.InternalVisit(AstVisitor visitor)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseUsingScopeModifierInNewRunspa
ces.AnalyzeScript(Ast ast, String fileName)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.<>c__DisplayClass83_1.b__2()
TargetObject : D:\GitLab-Runner\builds\armEq4Je\0\xxxx\xxxx-managed-scripts\Infra\roles\role_check_server_sanity\files\Script\dummy.ps1
CategoryInfo : InvalidOperation: (D:\GitLab-Runne...dummy.ps1:String) [Invoke-ScriptAnalyzer], ArgumentE
xception
FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace :
PipelineIterationInfo : {0, 1, 0}
Environment data
The text was updated successfully, but these errors were encountered: