From d58e5bbcdfff92b4111f3fc97cd14da9dce6e4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 29 Jun 2020 20:44:53 +0200 Subject: [PATCH] Relax assert in ResolveTokenInScope (#38542) `ResolveTokenInScope` now gets called with `typeOrMethodContext` that is a non-generic method. Make sure the method is on the same type. --- src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs index 27f3c48c1c3..766a41f69e7 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs @@ -1010,8 +1010,10 @@ namespace Internal.JitInterface else { var methodContext = (MethodDesc)typeOrMethodContext; - Debug.Assert(methodContext.GetTypicalMethodDefinition() == owningMethod.GetTypicalMethodDefinition() || + Debug.Assert((!methodContext.HasInstantiation && !owningMethod.HasInstantiation) || + methodContext.GetTypicalMethodDefinition() == owningMethod.GetTypicalMethodDefinition() || (owningMethod.Name == "CreateDefaultInstance" && methodContext.Name == "CreateInstance")); + Debug.Assert(methodContext.OwningType.HasSameTypeDefinition(owningMethod.OwningType)); typeInst = methodContext.OwningType.Instantiation; methodInst = methodContext.Instantiation; }