Prerequisites
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
Environment 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.0
Visuals
No response
Prerequisites
Steps to reproduce
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 charactersbut it has become "the number of chars argument" and 2 is wrapped in quotes.
Expected behavior
Actual behavior
Error details
N/aEnvironment data
Visuals
No response