-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Error message when ValidateLength fails was not proof-read #25566
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
PS> function foo {param ( [ValidateLength(0,2)]$bar)
>> $bar
>> }
PS> foo "11111"
foo: Cannot validate argument on parameter 'bar'. The character length of the 5 argument is too long. Shorten the character length of the argument so it is fewer than or equal to "2" characters, and then try the command again.
PS>
It seems the author meant something like The character length of the "bar" argument is too long at 5 characters. Shorten the character length of the argument so it is fewer than or equal to 2 characters
but it has become "the number of chars argument" and 2 is wrapped in quotes.
Expected behavior
PS> function foo {param ( [ValidateLength(0,2)]$bar)
>> $bar
>> }
PS> foo "11111"
The character length of the "bar" argument is too long at 5 characters. Shorten the character length of the argument so it is fewer than or equal to 2 characters`Actual behavior
PS> function foo {param ( [ValidateLength(0,2)]$bar)
>> $bar
>> }
PS> foo "11111"
foo: Cannot validate argument on parameter 'bar'. The character length of the 5 argument is too long. Shorten the character length of the argument so it is fewer than or equal to "2" characters, and then try the command again.Error details
N/aEnvironment data
Name Value
---- -----
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors