Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: Remove System.Collections.Generic.ReadOnlyCollection<T> as a base class of ReadOnlyList<T> #111

Open
NightOwl888 opened this issue Sep 17, 2024 · 0 comments
Labels
is:enhancement New feature or request pri:normal up for grabs This issue is open to be worked on by anyone
Milestone

Comments

@NightOwl888
Copy link
Owner

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.

@NightOwl888 NightOwl888 added is:enhancement New feature or request pri:normal up for grabs This issue is open to be worked on by anyone labels Sep 17, 2024
@NightOwl888 NightOwl888 added this to the 3.0 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:enhancement New feature or request pri:normal up for grabs This issue is open to be worked on by anyone
Projects
None yet
Development

No branches or pull requests

1 participant