Search

Array parameters with the ValidateSet attribute are incorrectly represented in the show-command ui by BFHobbes

Active

1
0
Sign in
to vote
Type: Bug
ID: 771327
Opened: 11/15/2012 11:06:19 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
If you have an advance script method which has an parameter with an array type, and the ValidateSet attribute to make sure that each value in the array is in the set. The the show-command ui parameter wizard will display a combo box for that value allowing the user to select only a single value from the set, instead of allowing multiple values to be specified.
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

No, this is new to the most recent version
Reproduction Steps
create a module creating an advanced script function using ValidateSet on an array parameter. For instance :

function test-validateset
{
[CmdletBinding()]
Param(
     [ValidateSet("A","B","C")]
     [array]$testparam
)

etc


Now when you select this method in the ise commands addin or using the show-command, the testparam parameter will be represented with a combo box containing the values a, b & c, however the as the testparam parameter is an array I should be able to specify multiple values.

i.e. From the powershell console I can execute :

test-validateset -testparam a,c

And each value in the testparam array is validated against the set. However using the show-command ui I am limited to only selecting a single value.
Expected Results
Ideally some kind of array aware control, which would allow multiple values to be added. Or in the least a text edit control so that at least multiple values can be specified similar to the behavior of a normal array parameter which doesn't have the ValidateSet attribute added.
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.