Open Tim-Pohlmann opened 1 month ago
This NRE is a special case of the fact that the parameterless constructor of ImmutableArray<T>
results in an object that throws on most access. Perhaps the new rule can trigger on uses of that constructor instead. If a "null" value of ImmutableArray<T>
is needed, I'd say the developer should be explicit and write default
.
Using a collection initializer with the
ImmutableArray
type, causes aNullReferenceException
.SharpLab