-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
The J2N.ReadOnlyList<T>
subclasses System.Collections.Generic.ReadOnlyCollection<T>
. System.Collections.Generic.ReadOnlyCollection<T>.GetEnumerator()
has changed in behavior in .NET 8 (or possibly .NET 7) so that it returns an enumerator that throws when it is empty. This means we have different behavior between .NET 8 and older targets. We had to add FEATURE_READONLYCOLLECTION_ENUMERATOR_EMPTY_CURRENT_UNDEFINEDOPERATION_DOESNOTTHROW
as a workaround, since removing the subclass is a breaking change that requires a major version bump.
So, the task is to copy the contents of System.Collections.Generic.ReadOnlyCollection<T>
to our ReadOnlyList<T>
class (not sure why Microsoft screwed up the name, it accepts IList<T>
rather than ICollection<T>
through the constructor), remove the System.Collections.Generic.ReadOnlyCollection<T>
base class, and remove the FEATURE_READONLYCOLLECTION_ENUMERATOR_EMPTY_CURRENT_UNDEFINEDOPERATION_DOESNOTTHROW
so all of our tests are consistent.