-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ParameterSet Binding Error in PS5.0+ #2212
Labels
Up-for-Grabs
Up-for-grabs issues are not high priorities, and may be opportunities for external contributors
WG-Engine
core PowerShell engine, interpreter, and runtime
Comments
@daxian-dbw can you please unassign yourself from this unless you're actively working on it? |
SteveL-MSFT
added
the
Up-for-Grabs
Up-for-grabs issues are not high priorities, and may be opportunities for external contributors
label
Nov 2, 2016
I planed to investigate and work on it, though haven't got to it yet. |
I recognize that this probably feels like something you meant to do, at this point, but can't we please fix this, or at least make it error or warn that things have gone badly wrong? |
microsoft-github-policy-service
bot
added
the
Resolution-No Activity
Issue has had no activity for 6 months or more
label
Nov 16, 2023
How can we just ignore this? |
microsoft-github-policy-service
bot
removed
the
Resolution-No Activity
Issue has had no activity for 6 months or more
label
Nov 17, 2023
microsoft-github-policy-service
bot
added
the
Resolution-No Activity
Issue has had no activity for 6 months or more
label
May 15, 2024
Bump |
microsoft-github-policy-service
bot
removed
the
Resolution-No Activity
Issue has had no activity for 6 months or more
label
May 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Up-for-Grabs
Up-for-grabs issues are not high priorities, and may be opportunities for external contributors
WG-Engine
core PowerShell engine, interpreter, and runtime
When binding with multiple parameter sets, the binder confuses
position
and sets the wrong value on the parameter.This bug exists since at least PS 4
Steps to reproduce
Expected behavior
The expected output is:
Actual behavior
The
$First
parameter is incorrectly bound to the same value as the$Second
parameter:Environment data
This happens on PowerShell 4, 5, and 6.0.0-alpha.9
Experimental Notes
The bug is caused by having the
Position
index of the first parameter in the non-matched parameter set be the same as thePosition
index of the second parameter in the matched parameter set.That is, if you change
[Parameter(ParameterSetName = 'One', Position = 1)]
to[Parameter(ParameterSetName = 'One', Position = 0)]
it is does not occurAnd if you change
[Parameter(ParameterSetName = 'Two', Position = 1)]
to[Parameter(ParameterSetName = 'Two', Position = 10)]
it does not occurBut if you change them both to, say,
Position = 5
then it does occur. Even if there are other parameters and other parameter sets.And of course, if you specify the parameter name when you call it, or if the parameters are of different types, then this does not occur.
The text was updated successfully, but these errors were encountered: