Windows PowerShell 5.1
PowerShell 7.0
PowerShell 7.1 Preview 1
A gramatically incorrect error message is returned when the length of a string
parameter's argument exceeds the range specified by a ValidateLengthAttribute.
Function Test-ValidateLength {
param(
[ValidateLength(1,5)][string]$Text
)
}
Test-ValidateLength '123456'
"Cannot validate argument on parameter 'Text'. The character length (6) of the argument is
too long. Shorten the character length …"
"Cannot validate argument on parameter 'Text'. The character length of the 6 argument is
too long. Shorten the character length …"
Looks like simply changing Line 178 to look similar to line 175.
That being said, it would probably be a good idea to open this issue over there instead: https://github.com/PowerShell/PowerShell/issues/new/choose
I did as you suggested and opened a "Documentation issue".