From 252e01d29ab79ffa91d96772efde8d8df1fcd881 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 --- src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs b/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs index 8f7ad70e29ab..69363d6c0173 100644 --- a/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs +++ b/src/Common/src/CoreLib/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;