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
But this might undesirably affect other functions, see: #18740 (and possibly even VSCode extensions)
Besides as Set-StrictMode isn't strictly linked to a function, it might get disconnected from specific tests when e.g. dot sourced:
[Diagnostics.CodeAnalysis.StrictMode(version=6)]
functionMyStrictFunction {
param(
$FormatAccentColor=$Host.PrivateData.FormatAccentColor
)
process {
Write-Host'...'
}
}
functionALooselyFunction { # (in the same scope of MyStrictFunction)Write-Host$SomethingThatIsNotSet
}
changed the title [-]Control `StrictMode` from the `System.Diagnostics.CodeAnalysis Namespace`[/-][+]Bind `StrictMode` to a specific function[/+]on Oct 5, 2023
Activity
iRon7 commentedon Oct 5, 2023
Or probably better, using
[CmdletBinding()], something like (wishful thinking):[-]Control `StrictMode` from the `System.Diagnostics.CodeAnalysis Namespace`[/-][+]Bind `StrictMode` to a specific function[/+]