Open
Description
Found during adding nullable annotations to TypeConverter (#54961)
Current logic of PropertyDescriptorCollection is inconsistent about allowing null PropertyDescriptor, i.e.:
- constructors taking
PropertyDescriptor[]
do not guard against null values Add
,Insert
,Remove
doesn't have a null checkFind
if it encounters null property when searching will in many cases throw NRE as it accessesName
without any null checks- anything triggering sorting (
InternalSort
) for non empty collection will most likely throw NRE because it accessesName
without null checks
I've conservatively marked them as non-accepting the null as that will provide most intuitive experience. The solution here is to do one of the following:
- add null checks and throw on null
- allow for nulls everywhere