-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Description
Steps to reproduce
function foo { param([ValidateCount(2,2)] [string[]] $bar) }; foo 1; foo 1, 2, 3Expected behavior
An error message indicating that exactly 2 arguments (array elements) are expected.
Actual behavior
Cannot validate argument on parameter 'bar'. The number of provided arguments (1) is fewer than the minimum number of allowed arguments (2). Provide more than 2 arguments,
and then try the command again.
Cannot validate argument on parameter 'bar'. The number of provided arguments, (3), exceeds the maximum number of allowed arguments (2). Provide fewer than 2 arguments, and
then try the command again.
Note:
-
The error messages do not take into account that the lower and upper bound are the same.
-
Aside from that, the wording is incorrect: it should say "2 or more" rather than "more than 2" and "2 or fewer" rather than "fewer than 2".
Environment data
PowerShell Core v6.0.0-alpha (v6.0.0-alpha.18) on Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues