Fix for issue #5467: [R2R] InvalidCastException in timer tests. (#5478)
authorFadi Hanna <fadim@microsoft.com>
Fri, 3 Jun 2016 23:30:37 +0000 (16:30 -0700)
committerFadi Hanna <fadim@microsoft.com>
Fri, 3 Jun 2016 23:30:37 +0000 (16:30 -0700)
We were not using the correct MethodTable pointer when constructing delegate objects to interface methods

src/vm/comdelegate.cpp

index b6cab68..071c65b 100644 (file)
@@ -2112,8 +2112,8 @@ FCIMPL3(void, COMDelegate::DelegateConstruct, Object* refThisUNSAFE, Object* tar
                                 {
                                     pMeth = MethodDesc::FindOrCreateAssociatedMethodDesc(
                                         pDispatchSlotMD,
-                                        pDispatchSlotMD->GetMethodTable(),
-                                        (!pDispatchSlotMD->IsStatic() && pDispatchSlotMD->GetMethodTable()->IsValueType()),
+                                        pMTTarg,
+                                        (!pDispatchSlotMD->IsStatic() && pMTTarg->IsValueType()),
                                         pMeth->GetMethodInstantiation(),
                                         FALSE /* allowInstParam */);
                                 }