-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
EnsureCapacity() on List<> increments the version #82455
Comments
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsDescriptionApparent oversight: Setting Reproduction Stepsvar x = new List<int>();
var e = x.GetEnumerator();
x.EnsureCapacity(10);
e.MoveNext(); // collection modified exception due to version increment Expected behaviorCalling Actual behaviorCalling Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
See #81523 |
Yeah, I mentioned this in that discussion as well but wanted to create an issue to track this specifically in case a decision is made to keep the version checks. |
Description
Apparent oversight: Setting
Capacity
or callingTrimExcess()
onList<>
does not increment the version but callingEnsureCapacity(int)
does.Reproduction Steps
Expected behavior
Calling
EnsureCapacity
should not increment the version.Actual behavior
Calling
EnsureCapacity
increments the version.Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: