public static void RhpReversePInvokeBadTransition() { IntPtr returnAddress = BinderIntrinsics.GetReturnAddress(); if (returnAddress != IntPtr.Zero) { EH.FailFastViaClasslib( RhFailFastReason.IllegalNativeCallableEntry, null, returnAddress); } else { // @HACKHACK: we need to force the method to have an EBP frame so that we can use the // GetReturnAddress() intrinsic above. This seems to be the smallest way to do this. EH.FailFast(RhFailFastReason.InternalError, null); throw EH.GetClasslibException(ExceptionIDs.Arithmetic, returnAddress); } }
private static IntPtr RhpCidResolve(object pObject, IntPtr pCell) { try { EEType *pInterfaceType; ushort slot; InternalCalls.RhpGetDispatchCellInfo(pCell, &pInterfaceType, &slot); IntPtr pTargetCode = RhResolveDispatchWorker(pObject, pInterfaceType, slot); if (pTargetCode != IntPtr.Zero) { return(InternalCalls.RhpUpdateDispatchCellCache(pCell, pTargetCode, pObject.EEType)); } } catch { // Exceptions are not permitted to escape from runtime->managed callbacks EH.FailFast(RhFailFastReason.InternalError, null); } // "Valid method implementation was not found." EH.FailFast(RhFailFastReason.InternalError, null); return(IntPtr.Zero); }