The check that rejects a list for -AccessType and -AppliesTo opened every level
of a collection of one element, so that a collection that holds itself never
returned. It opens at most 32 levels now and counts a deeper nesting as a list,
and it stops reading a collection after the second element, so that a long or
endless sequence is not read to its end.
The message names what the caller wrote: the one element of a collection of one
element (also when that element is a collection itself), the first ten elements
of a longer collection followed by "...", and otherwise the text of the value.
Before, a collection of one misspelled name was named by its type.
Tests, written first: 28 rows failed on the previous build in all four
configurations and none fails now. They cover an array of one misspelled name,
a collection nested 40 levels deep for both parameters of both cmdlets, and an
array that holds an array of one name, which stays valid. The assertion of the
value text expects "The value '<text>'", because the old pattern could also
match the name of a type. The comments say that PowerShell combines the numbers
of a list bit by bit, which is what it does, and not that it adds them.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>