Skip to content

Same param specified twice discards parameter variable attributes #3301

Description

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

3
3

Actual behavior

3
0

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions