summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDávid Kaya <mail@davidkaya.sk>2018-07-28 06:14:32 +0200
committerDan Moseley <danmose@microsoft.com>2018-07-27 21:14:32 -0700
commit5d31194880e800a9df8eef76e7a0a53646aa72d3 (patch)
tree57e0b01b91a8dad0ee40ef883b5a7845e1e2c547
parentae5909995075f916e0a91804c41f7cf3994779c5 (diff)
downloadcoreclr-5d31194880e800a9df8eef76e7a0a53646aa72d3.tar.gz
coreclr-5d31194880e800a9df8eef76e7a0a53646aa72d3.tar.bz2
coreclr-5d31194880e800a9df8eef76e7a0a53646aa72d3.zip
Added version increment for TrimExcess and EnsureCapacity (#19096)
* Added version increment for TrimExcess and EnsureCapacity * Added old unit test to exclusion list * Excluded missing unit tests
-rw-r--r--src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs2
-rw-r--r--tests/CoreFX/CoreFX.issues.json12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
index 8f7ad70e29..69363d6c01 100644
--- a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
+++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
@@ -970,6 +970,7 @@ namespace System.Collections.Generic
int currentCapacity = _entries == null ? 0 : _entries.Length;
if (currentCapacity >= capacity)
return currentCapacity;
+ _version++;
if (_buckets == null)
return Initialize(capacity);
int newSize = HashHelpers.GetPrime(capacity);
@@ -1009,6 +1010,7 @@ namespace System.Collections.Generic
return;
int oldCount = _count;
+ _version++;
Initialize(newSize);
Entry[] entries = _entries;
int[] buckets = _buckets;
diff --git a/tests/CoreFX/CoreFX.issues.json b/tests/CoreFX/CoreFX.issues.json
index 54ba010102..5b85243123 100644
--- a/tests/CoreFX/CoreFX.issues.json
+++ b/tests/CoreFX/CoreFX.issues.json
@@ -407,6 +407,18 @@
{
"name": "System.Collections.Tests.Dictionary_IDictionary_NonGeneric_Tests.IEnumerable_NonGeneric_Enumerator_MoveNext_ModifiedAfterEnumeration_ThrowsInvalidOperationException",
"reason": "Assert.All() Failure: 1 out of 4 items in the collection did not pass.\r\n"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_Generic_Tests_SimpleInt_int_With_Comparer_WrapStructural_SimpleInt.EnsureCapacity_Generic_RequestingLargerCapacity_DoesNotInvalidateEnumeration",
+ "reason": "outdated"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_Generic_Tests_string_string.EnsureCapacity_Generic_RequestingLargerCapacity_DoesNotInvalidateEnumeration",
+ "reason": "outdated"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_Generic_Tests_int_int.EnsureCapacity_Generic_RequestingLargerCapacity_DoesNotInvalidateEnumeration",
+ "reason": "outdated"
}
]
}