From 53d3bddc936e16b34fbe71cfd33964c83709600c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Rylek?= Date: Tue, 13 Apr 2021 16:40:53 -0700 Subject: [PATCH] Fix Crossgen2 compilation failures in several type generator tests (#51090) As the PR https://github.com/dotnet/runtime/pull/44041 effectively decoupled OwningType from Method in MethodWithToken, I believe we now need to include OwningType in the Equals check, otherwise we may (and sometimes do) crash in the assertion failure checking that OwningType matches between instances. Thanks Tomas --- .../JitInterface/CorInfoImpl.ReadyToRun.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index 56a3cce1302..60fe8683e22 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -221,8 +221,9 @@ public override int GetHashCode() public bool Equals(MethodWithToken methodWithToken) { - bool equals = Method == methodWithToken.Method && Token.Equals(methodWithToken.Token) && ConstrainedType == methodWithToken.ConstrainedType && - Unboxing == methodWithToken.Unboxing; + bool equals = Method == methodWithToken.Method && Token.Equals(methodWithToken.Token) + && OwningType == methodWithToken.OwningType && ConstrainedType == methodWithToken.ConstrainedType + && Unboxing == methodWithToken.Unboxing; if (equals) { Debug.Assert(OwningTypeNotDerivedFromToken == methodWithToken.OwningTypeNotDerivedFromToken); -- GitLab