Open
Description
Steps to reproduce
This does not happen if you have a file only containing:
Az.Monitor\Get-AzDataCollectionRuleAssociation
Thus:
-
VSCode
settings.json
contains:"powershell.codeFormatting.useCorrectCasing": true
. -
Create
temp.ps1
with following content:Write-Information -MessageData 'Adding associations.' $DCRs | ForEach-Object -ThrottleLimit $DCRs.'Count' -Parallel { $null = Add-Member -InputObject $_ -MemberType 'NoteProperty' -Force -Name 'associations' -Value ( [array]( Az.Monitor\Get-AzDataCollectionRuleAssociation -SubscriptionId $_.'subscriptionId' ` -ResourceGroupName $_.'resourceGroup' -DataCollectionRuleName $_.'name' ) ) } 6>$null
-
Save. The content becomes:
Write-Information -MessageData 'Adding associations.' $DCRs | ForEach-Object -ThrottleLimit $DCRs.'Count' -Parallel { $null = Add-Member -InputObject $_ -MemberType 'NoteProperty' -Force -Name 'associations' -Value ( [array]( Get-AzDataCollectionRuleAssociation -SubscriptionId $_.'subscriptionId' ` -ResourceGroupName $_.'resourceGroup' -DataCollectionRuleName $_.'name' ) ) } 6>$null
Expected behavior
Content should not change.
Actual behavior
Az.Monitor\
gets stripped.
Environment data
- PowerShell v7.4.5
- vscode-powershell v2024.2.2
- PSScriptAnalyzer in vscode-powershell v2024.2.2: v1.22.0