summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-01-24 01:11:31 +0100
committerJan Kotas <jkotas@microsoft.com>2018-01-23 16:11:31 -0800
commit007fa5528ba3aee5bbb6c4397cc576a5cd88f8b0 (patch)
tree04863a210b93cce74ca61105af8137f7581f7986 /src
parent3211c255a54b2956b345ba85e7be371548264e7a (diff)
downloadcoreclr-007fa5528ba3aee5bbb6c4397cc576a5cd88f8b0.tar.gz
coreclr-007fa5528ba3aee5bbb6c4397cc576a5cd88f8b0.tar.bz2
coreclr-007fa5528ba3aee5bbb6c4397cc576a5cd88f8b0.zip
Catch ambiguous interface method resolution exceptions (#15978)
Default interface methods might end up being ambiguous. This thows an exception we need to catch.
Diffstat (limited to 'src')
-rw-r--r--src/vm/jitinterface.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index d08ba0cbe2..b238de8cba 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -8860,13 +8860,32 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE
pOwnerMT = pOwnerMT->GetCanonicalMethodTable();
}
- pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(TypeHandle(pOwnerMT), pBaseMD);
+ // In a try block because the interface method resolution might end up being
+ // ambiguous (diamond inheritance case of default interface methods).
+ EX_TRY
+ {
+ pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(TypeHandle(pOwnerMT), pBaseMD);
+ }
+ EX_CATCH
+ {
+ }
+ EX_END_CATCH(RethrowTransientExceptions)
}
else if (!pBaseMD->HasClassOrMethodInstantiation())
{
- pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(pBaseMD);
+ // In a try block because the interface method resolution might end up being
+ // ambiguous (diamond inheritance case of default interface methods).
+ EX_TRY
+ {
+ pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(pBaseMD);
+ }
+ EX_CATCH
+ {
+ }
+ EX_END_CATCH(RethrowTransientExceptions)
}
- else
+
+ if (pDevirtMD == nullptr)
{
return nullptr;
}