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
When a variable is declared either in the begin block or statement block of a ForEach-Object pipeline, the PSScriptAnalyzer incorrectly flags it as assigned but never used.
Examples:
$Count is incorreclty flagged as assigned but never used $myArray = @() $myArray += "Item1" $myArray += "Item2" $myArray += "Item3" $myArray += "Item4" $myArray | ForEach-Object {$Count = 0} {$Count++; $Count}
The text was updated successfully, but these errors were encountered:
System Details
PSVersion 5.0.10586.962
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.962
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
When a variable is declared either in the begin block or statement block of a ForEach-Object pipeline, the PSScriptAnalyzer incorrectly flags it as assigned but never used.
Examples:
$Count is incorreclty flagged as assigned but never used
$myArray = @()
$myArray += "Item1"
$myArray += "Item2"
$myArray += "Item3"
$myArray += "Item4"
$myArray | ForEach-Object {$Count = 0} {$Count++; $Count}
The text was updated successfully, but these errors were encountered: