示例#1
0
 public sealed override Object Invoke(Object thisObject, Object[] arguments)
 {
     MethodInvokerUtils.ValidateThis(thisObject, _declaringTypeHandle);
     return(RuntimeAugments.CallDynamicInvokeMethod(
                thisObject, MethodInvokeInfo.LdFtnResult, null, MethodInvokeInfo.DynamicInvokeMethod, MethodInvokeInfo.DynamicInvokeGenericDictionary, MethodInvokeInfo.DefaultValueString, arguments,
                invokeMethodHelperIsThisCall: false, methodToCallIsThisCall: true));
 }
示例#2
0
        public sealed override Object Invoke(Object thisObject, Object[] arguments)
        {
            MethodInvokerUtils.ValidateThis(thisObject, _declaringTypeHandle);

            IntPtr resolvedVirtual = OpenMethodResolver.ResolveMethod(MethodInvokeInfo.VirtualResolveData, thisObject);

            Object result = RuntimeAugments.CallDynamicInvokeMethod(
                thisObject, resolvedVirtual, null, MethodInvokeInfo.DynamicInvokeMethod, MethodInvokeInfo.DynamicInvokeGenericDictionary, MethodInvokeInfo.DefaultValueString, arguments,
                invokeMethodHelperIsThisCall: false, methodToCallIsThisCall: true);

            return(result);
        }
示例#3
0
        public sealed override Object Invoke(Object thisObject, Object[] arguments)
        {
            MethodInvokerUtils.ValidateThis(thisObject, _declaringTypeHandle);
            object result = RuntimeAugments.CallDynamicInvokeMethod(
                thisObject,
                MethodInvokeInfo.LdFtnResult,
                null /*thisPtrDynamicInvokeMethod*/,
                MethodInvokeInfo.DynamicInvokeMethod,
                MethodInvokeInfo.DynamicInvokeGenericDictionary,
                MethodInvokeInfo.MethodInfo,
                arguments,
                invokeMethodHelperIsThisCall: false,
                methodToCallIsThisCall: true);

            System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
            return(result);
        }
示例#4
0
        public sealed override Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle)
        {
            MethodInvokerUtils.ValidateThis(thisObject, _declaringTypeHandle);

            IntPtr resolvedVirtual = OpenMethodResolver.ResolveMethod(MethodInvokeInfo.VirtualResolveData, thisObject);

            Object result = RuntimeAugments.CallDynamicInvokeMethod(
                thisObject,
                resolvedVirtual,
                null /*thisPtrDynamicInvokeMethod*/,
                MethodInvokeInfo.DynamicInvokeMethod,
                MethodInvokeInfo.DynamicInvokeGenericDictionary,
                MethodInvokeInfo.MethodInfo,
                arguments,
                binderBundle,
                invokeMethodHelperIsThisCall: false,
                methodToCallIsThisCall: true);

            System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
            return(result);
        }
示例#5
0
        public override Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle)
        {
            //@todo: This does not handle optional parameters (nor does it need to as today we're only using it for three synthetic array methods.)
            if (!(thisObject == null && 0 != (_options & InvokerOptions.AllowNullThis)))
            {
                MethodInvokerUtils.ValidateThis(thisObject, _thisType);
            }
            if (arguments == null)
            {
                arguments = Array.Empty <Object>();
            }
            if (arguments.Length != _parameterTypes.Length)
            {
                throw new TargetParameterCountException();
            }
            Object[] convertedArguments = new Object[arguments.Length];
            for (int i = 0; i < arguments.Length; i++)
            {
                convertedArguments[i] = RuntimeAugments.CheckArgument(arguments[i], _parameterTypes[i], binderBundle);
            }
            Object result;

            try
            {
                result = _invoker(thisObject, convertedArguments);
            }
            catch (Exception e)
            {
                if (0 != (_options & InvokerOptions.DontWrapException))
                {
                    throw;
                }
                else
                {
                    throw new TargetInvocationException(e);
                }
            }
            return(result);
        }