From b896e92ab0c0832bb50f9152e3541f5fa26dfde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Kaya?= Date: Sat, 28 Jul 2018 06:14:32 +0200 Subject: [PATCH] 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 Signed-off-by: dotnet-bot --- .../shared/System/Collections/Generic/Dictionary.cs | 2 ++ 1 file changed, 2 insertions(+) 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 8f7ad70e29a..69363d6c017 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 @@ public int EnsureCapacity(int capacity) 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 @@ public void TrimExcess(int capacity) return; int oldCount = _count; + _version++; Initialize(newSize); Entry[] entries = _entries; int[] buckets = _buckets;