Closed
Description
Issue Type: Bug
Create a PowerShell file in VSCode with the following content:
5..10 | ForEach-Object {$id=1} {
Write-Output $id
$id++
}
Expected result: Code has 0 problems
Actual result: Code has 1 problem:
{
"resource": "Untitled-1.ps1",
"owner": "generated_diagnostic_collection_name#2",
"code": "PSUseDeclaredVarsMoreThanAssignments",
"severity": 4,
"message": "The variable 'id' is assigned but never used.",
"source": "PSScriptAnalyzer",
"startLineNumber": 1,
"startColumn": 25,
"endLineNumber": 1,
"endColumn": 28
}
Extension version: 2020.3.0
VS Code version: Code 1.44.0 (2aae1f26c72891c399f860409176fe435a154b13, 2020-04-07T23:31:18.860Z)
OS version: Windows_NT x64 10.0.18363