From 4eff1525b36a1a9293ec23665dc775562bca910d Mon Sep 17 00:00:00 2001 From: "Yi Zhang (CLR)" Date: Fri, 28 Apr 2017 08:41:29 -0700 Subject: [PATCH] Fix R2R issue with virtual method resolving to non-generic base (dotnet/coreclr#11289) Commit migrated from https://github.com/dotnet/coreclr/commit/6bfd4789a274c92f7839796f9ba7acfa1cc1e634 --- src/coreclr/src/vm/compile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/coreclr/src/vm/compile.cpp b/src/coreclr/src/vm/compile.cpp index 9161585..76a4147 100644 --- a/src/coreclr/src/vm/compile.cpp +++ b/src/coreclr/src/vm/compile.cpp @@ -1723,6 +1723,12 @@ mdToken CEECompileInfo::TryEncodeMethodAsToken( if (!pReferencingModule->IsInCurrentVersionBubble()) return mdTokenNil; + // If this is a MemberRef with TypeSpec, we might come to here because we resolved the method + // into a non-generic base class in the same version bubble. However, since we don't have the + // proper type context during ExternalMethodFixupWorker, we can't really encode using token + if (pResolvedToken->pTypeSpec != NULL) + return mdTokenNil; + unsigned methodToken = pResolvedToken->token; switch (TypeFromToken(methodToken)) -- 2.7.4