diff --git a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs index 5ad90f93e754..0686aee19d8d 100644 --- a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs +++ b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs @@ -392,7 +392,7 @@ private ref Entry FindEntryDefaultComparer(TKey key, out bool found) } found = false; - return ref s_nullEntry; + return ref NotFound; } private ref Entry FindEntryCustomComparer(TKey key, IEqualityComparer comparer, out bool found) @@ -416,7 +416,13 @@ private ref Entry FindEntryCustomComparer(TKey key, IEqualityComparer comp } found = false; - return ref s_nullEntry; + return ref NotFound; + } + + private static ref Entry NotFound + { + [MethodImpl(MethodImplOptions.NoInlining)] + get => ref s_nullEntry; } private int[] Initialize(int capacity)