Skip to content

Commit ba9e7e4

Browse files
mikernetjkotas
andcommitted
Remove duplicate GenericCache getter call, revert to direct throw
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
1 parent 9a1dc54 commit ba9e7e4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ public static object GetUninitializedObject(
188188
if (type is not RuntimeType rt)
189189
{
190190
ArgumentNullException.ThrowIfNull(type);
191-
static void Throw(Type type) => throw new SerializationException(SR.Format(SR.Serialization_InvalidType, type));
192-
Throw(type);
191+
throw new SerializationException(SR.Format(SR.Serialization_InvalidType, type));
193192
}
194193

195194
return rt.GetUninitializedObject();

src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,9 +3886,11 @@ private void CreateInstanceCheckThis()
38863886
[DebuggerHidden]
38873887
internal object GetUninitializedObject()
38883888
{
3889-
if (GenericCache is not CreateUninitializedCache cache)
3889+
object? genericCache = GenericCache;
3890+
3891+
if (genericCache is not CreateUninitializedCache cache)
38903892
{
3891-
if (GenericCache is ActivatorCache activatorCache)
3893+
if (genericCache is ActivatorCache activatorCache)
38923894
{
38933895
cache = activatorCache.GetCreateUninitializedCache(this);
38943896
}

0 commit comments

Comments
 (0)