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
Setting Set-StrictMode to a specific -Version level automatically implies that all prior prohibitors are enabled. Meaning that there is no way just select for a recent prohibitor (e.g. "out of bounds or unresolvable array indexes") without also selecting a earlier prohibitor (e.g. "references to uninitialized variables").
A -Modes parameter that supports certain prohibit flags, e.g.:
will avoid that.
The lack of selective prohibitors also holds back the future extensions of the Set-StrictMode cmdlet as e.g. #15781Strict Write-Output.
Even if lexical scoping were to be introduced, the dynamic scoping of the existing strict modes would have to be retained for backward compatibility, which would invite confusion and subtle bugs.
A different way to implement lexical scoping is by excluding using SuppressMessageAttribute Class in the cmdlet binding similar to the approach of PSScriptAnalyzer.
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
Activity
iRon7 commentedon Nov 10, 2021
Also possible (false positive) bugs in specific
Set-StrictModemodes as in#16427Set-StrictMode -Version Latest: False positive for references to non-existent properties of an object could be excluded/suppressed while still being able to as strict as possible with the rest of the prohibitors, using a command as e.g.:Set-StrictMode -Mode 29iRon7 commentedon Nov 29, 2021
Michael Klement (@mklement0),
A different way to implement lexical scoping is by excluding using SuppressMessageAttribute Class in the cmdlet binding similar to the approach of PSScriptAnalyzer.
iRon7 commentedon Nov 15, 2023
I have closed this issue in favor of issue #20432
microsoft-github-policy-service commentedon May 13, 2024
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.