diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeType.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeType.cs index e9fca05ca80124..70823852b923f6 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeType.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeType.cs @@ -204,7 +204,12 @@ public override Array GetEnumValuesAsUnderlyingType() } public override int GetHashCode() - => ((nuint)_pUnderlyingEEType).GetHashCode(); + { + MethodTable* pEEType = _pUnderlyingEEType; + if (pEEType != null) + return ((nuint)pEEType).GetHashCode(); + return RuntimeHelpers.GetHashCode(this); + } public override RuntimeTypeHandle TypeHandle {