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 check
Find if it encounters null property when searching will in many cases throw NRE as it accesses Name without any null checks
- anything triggering sorting (
InternalSort) for non empty collection will most likely throw NRE because it accesses Name 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
Found during adding nullable annotations to TypeConverter (#54961)
Current logic of PropertyDescriptorCollection is inconsistent about allowing null PropertyDescriptor, i.e.:
PropertyDescriptor[]do not guard against null valuesAdd,Insert,Removedoesn't have a null checkFindif it encounters null property when searching will in many cases throw NRE as it accessesNamewithout any null checksInternalSort) for non empty collection will most likely throw NRE because it accessesNamewithout null checksI'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: