summaryrefslogtreecommitdiff
path: root/src/vm/comdelegate.cpp
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2016-06-01 13:05:45 -0700
committerFadi Hanna <fadim@microsoft.com>2016-06-01 13:05:45 -0700
commitc1cf38369531d9fb98a1b26166a1e48c0c8c808d (patch)
tree14822e3535217cfe8d46c12b6e4e9cd3887dbfb1 /src/vm/comdelegate.cpp
parent53e54494042e7a567364725ea61d9a7e62effa9c (diff)
downloadcoreclr-c1cf38369531d9fb98a1b26166a1e48c0c8c808d.tar.gz
coreclr-c1cf38369531d9fb98a1b26166a1e48c0c8c808d.tar.bz2
coreclr-c1cf38369531d9fb98a1b26166a1e48c0c8c808d.zip
Fix for issue 5343: Assert Failure: !"Cannot take the address of an uninstantiated generic method." (#5347)
The problem was that the delegates code base was not correctly instantiating interface GVMs on target types (after finding the target method on the target type using slot numbers), and ended up calling uninstantiated generic method definitions on delegate invokes.
Diffstat (limited to 'src/vm/comdelegate.cpp')
-rw-r--r--src/vm/comdelegate.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp
index 57e28030b4..b6cab68ff9 100644
--- a/src/vm/comdelegate.cpp
+++ b/src/vm/comdelegate.cpp
@@ -2102,11 +2102,25 @@ FCIMPL3(void, COMDelegate::DelegateConstruct, Object* refThisUNSAFE, Object* tar
// <TODO>it looks like we need to pass an ownerType in here.
// Why can we take a delegate to an interface method anyway? </TODO>
//
- pMeth = pMTTarg->FindDispatchSlotForInterfaceMD(pMeth).GetMethodDesc();
- if (pMeth == NULL)
+ MethodDesc * pDispatchSlotMD = pMTTarg->FindDispatchSlotForInterfaceMD(pMeth).GetMethodDesc();
+ if (pDispatchSlotMD == NULL)
{
COMPlusThrow(kArgumentException, W("Arg_DlgtTargMeth"));
}
+
+ if (pMeth->HasMethodInstantiation())
+ {
+ pMeth = MethodDesc::FindOrCreateAssociatedMethodDesc(
+ pDispatchSlotMD,
+ pDispatchSlotMD->GetMethodTable(),
+ (!pDispatchSlotMD->IsStatic() && pDispatchSlotMD->GetMethodTable()->IsValueType()),
+ pMeth->GetMethodInstantiation(),
+ FALSE /* allowInstParam */);
+ }
+ else
+ {
+ pMeth = pDispatchSlotMD;
+ }
}
}
}