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

Dictionary version increment is missing for TrimExcess() and EnsureCapacity() #26784

Closed
danmoseley opened this issue Jul 11, 2018 · 2 comments
Closed
Labels
area-System.Collections help wanted [up-for-grabs] Good issue for external contributors
Milestone

Comments

@danmoseley
Copy link
Member

Dictionary<K,V> has a version field that is incremented by modification and tested by enumerators such that any modification of a dictionary during enumeration causes an exception. This is to flag that the enumeration may not lead to self consistent results.

Calls to TrimExcess() and EnsureCapacity() appear to not increment version even though they could modify the backing storage in such a way that they could break enumeration.

They should both have version++.

dotnet/coreclr#18854

danmoseley referenced this issue in dotnet-maestro-bot/corefx Jul 29, 2018
Tests for version increment in TrimExcess and EnsureCapacity (#31007)

Revert "Version increment for TrimExcess and EnsureCapacity (#31007)"

This reverts commit 92d8f19.

Tests for enumeration invalidation in TrimExcess and EnsureCapacity (#31007)
danmoseley referenced this issue in dotnet/corefx Jul 29, 2018
…9-03, preview1-26729-01, respectively (master) (#31450)

* Update CoreClr, CoreFx, CoreSetup to preview1-26729-04, preview1-26729-03, preview1-26729-01, respectively

* Version increment for TrimExcess and EnsureCapacity (#31007)

Tests for version increment in TrimExcess and EnsureCapacity (#31007)

Revert "Version increment for TrimExcess and EnsureCapacity (#31007)"

This reverts commit 92d8f19.

Tests for enumeration invalidation in TrimExcess and EnsureCapacity (#31007)
@satano
Copy link
Member

satano commented Aug 1, 2018

Hello. Can I take this one? Ping @danmosemsft

@Wraith2
Copy link
Contributor

Wraith2 commented Aug 11, 2018

I think this can be closed, it was fixed in dotnet/corefx#31062

@jkotas jkotas closed this as completed Aug 11, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Collections help wanted [up-for-grabs] Good issue for external contributors
Projects
None yet
Development

No branches or pull requests

5 participants