Steps to reproduce
Create script ./script.ps1 as follows:
param([ValidateSet('bar', 'baz')] [string] $Foo)
# Output count of attributes.
(Get-Variable Foo).Attributes.Count
Then dot-source the script twice:
> . ./script.ps1; . ./script.ps1
Expected behavior
Actual behavior
Repeated dot-sourcing happens implicitly when you run your code repeatedly in the ISE, for instance.
Environment data
PowerShell Core v6.0.0-alpha (v6.0.0-alpha.16) on Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
Steps to reproduce
Create script
./script.ps1as follows:Then dot-source the script twice:
Expected behavior
Actual behavior
Repeated dot-sourcing happens implicitly when you run your code repeatedly in the ISE, for instance.
Environment data