microsoft/referencesource

System.Collections.Generic.List<T> Sort(Comparison<T> comparison) doesn't invalidate the enumerator

BalintPogatsa opened this issue · 2 comments

Incrementing the _version field is probably missing from one overload of the Sort method in List after calling Array.Sort

Array.Sort(_items, 0, _size, comparer);

svick commented

This repository is not the right place to report issues with .Net.

For .Net Core/.Net 5+, this has already been fixed in dotnet/coreclr#8944.

For .Net Framework, you could report this issue on Developer Community, but I'm not convinced it would be fixed, considering the status of .Net Framework.

Thank you for the info.
Somehow I didn't manage to find List.cs in dotnet/runtime (System.Private.CoreLib did not seem like a place for the old System.Collections.Generic... )

I think that .NET Framework 4.8 still has a lifecycle without an end date, so I also thought these kind of bugfixes would be backported. Probably not a priority for MS.