From f16d1fac296c9705fd2b2c5ba28b999233485805 Mon Sep 17 00:00:00 2001 From: Tomas Date: Mon, 26 Apr 2021 21:09:20 +0200 Subject: [PATCH] Fix manipulation of signature type context in SVM resolution --- src/coreclr/vm/methodtable.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 2b5edad919fae4..2fd66badafe8c2 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -9196,6 +9196,7 @@ MethodTable::TryResolveVirtualStaticMethodOnThisType(MethodDesc* pInterfaceMD, B IMDInternalImport* pMDInternalImport = GetMDImport(); HENUMInternalMethodImplHolder hEnumMethodImpl(pMDInternalImport); hr = hEnumMethodImpl.EnumMethodImplInitNoThrow(GetCl()); + SigTypeContext sigTypeContext(this); if (FAILED(hr)) { @@ -9230,16 +9231,17 @@ MethodTable::TryResolveVirtualStaticMethodOnThisType(MethodDesc* pInterfaceMD, B MethodTable *pInterfaceMT = ClassLoader::LoadTypeDefOrRefOrSpecThrowing( GetModule(), tkParent, - NULL /*SigTypeContext*/) + &sigTypeContext) .GetMethodTable(); - if (pInterfaceMT != pInterfaceMD->GetMethodTable()) + if (pInterfaceMT != pInterfaceMD->GetMethodTable() && + pInterfaceMT->GetCanonicalMethodTable() != pInterfaceMD->GetMethodTable()) { continue; } MethodDesc *pMethodDecl = MemberLoader::GetMethodDescFromMemberDefOrRefOrSpec( GetModule(), methodDecl, - NULL /*SigTypeContext*/, + &sigTypeContext, /* strictMetadataChecks */ FALSE, /* allowInstParam */ FALSE); if (pMethodDecl == nullptr) @@ -9253,7 +9255,7 @@ MethodTable::TryResolveVirtualStaticMethodOnThisType(MethodDesc* pInterfaceMD, B MethodDesc *pMethodImpl = MemberLoader::GetMethodDescFromMemberDefOrRefOrSpec( GetModule(), methodBody, - NULL /*SigTypeContext*/, + &sigTypeContext, /* strictMetadataChecks */ FALSE, /* allowInstParam */ FALSE); if (pMethodImpl == nullptr)