object DoInvoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { if (binder == null) { binder = Type.DefaultBinder; } ParameterInfo[] pinfo = MonoMethodInfo.GetParametersInfo(mhandle, this); MonoMethod.ConvertValues(binder, parameters, pinfo, culture, invokeAttr); #if !NET_2_1 if (SecurityManager.SecurityEnabled) { // sadly Attributes doesn't tell us which kind of security action this is so // we must do it the hard way - and it also means that we can skip calling // Attribute (which is another an icall) SecurityManager.ReflectedLinkDemandInvoke(this); } #endif if (obj == null && DeclaringType.ContainsGenericParameters) { throw new MemberAccessException("Cannot create an instance of " + DeclaringType + " because Type.ContainsGenericParameters is true."); } if ((invokeAttr & BindingFlags.CreateInstance) != 0 && DeclaringType.IsAbstract) { throw new MemberAccessException(String.Format("Cannot create an instance of {0} because it is an abstract class", DeclaringType)); } return(InternalInvoke(obj, parameters)); }
internal object[] GetPseudoCustomAttributes() { int num = 0; MonoMethodInfo methodInfo = MonoMethodInfo.GetMethodInfo(this.mhandle); if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL) { num++; } if ((methodInfo.attrs & MethodAttributes.PinvokeImpl) != MethodAttributes.PrivateScope) { num++; } if (num == 0) { return(null); } object[] array = new object[num]; num = 0; if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL) { array[num++] = new PreserveSigAttribute(); } if ((methodInfo.attrs & MethodAttributes.PinvokeImpl) != MethodAttributes.PrivateScope) { DllImportAttribute dllImportAttribute = MonoMethod.GetDllImportAttribute(this.mhandle); if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL) { dllImportAttribute.PreserveSig = true; } array[num++] = dllImportAttribute; } return(array); }
internal void InitMessage (MonoMethod method, object [] out_args) { this.method = method; ParameterInfo[] paramInfo = method.GetParametersInternal (); int param_count = paramInfo.Length; args = new object[param_count]; arg_types = new byte[param_count]; asyncResult = null; call_type = CallType.Sync; names = new string[param_count]; for (int i = 0; i < param_count; i++) { names[i] = paramInfo[i].Name; } bool hasOutArgs = out_args != null; int j = 0; for (int i = 0; i < param_count; i++) { byte arg_type; bool isOut = paramInfo[i].IsOut; if (paramInfo[i].ParameterType.IsByRef) { if (hasOutArgs) args[i] = out_args[j++]; arg_type = 2; // OUT if (!isOut) arg_type |= 1; // INOUT } else { arg_type = 1; // IN if (isOut) arg_type |= 4; // IN, COPY OUT } arg_types[i] = arg_type; } }
object DoInvoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { if (binder == null) { binder = Type.DefaultBinder; } ParameterInfo[] pinfo = MonoMethodInfo.GetParametersInfo(mhandle, this); MonoMethod.ConvertValues(binder, parameters, pinfo, culture, invokeAttr); if (obj == null && DeclaringType.ContainsGenericParameters) { throw new MemberAccessException("Cannot create an instance of " + DeclaringType + " because Type.ContainsGenericParameters is true."); } if ((invokeAttr & BindingFlags.CreateInstance) != 0 && DeclaringType.IsAbstract) { throw new MemberAccessException(String.Format("Cannot create an instance of {0} because it is an abstract class", DeclaringType)); } return(InternalInvoke(obj, parameters)); }
static internal ParameterInfo GetReturnParameterInfo (MonoMethod method) { return new ParameterInfo (GetReturnType (method.mhandle), method, get_retval_marshal (method.mhandle)); }
internal extern void InitMessage (MonoMethod method, object [] out_args);
internal static extern MonoMethod get_base_method(MonoMethod method, bool definition);
static internal ParameterInfo GetReturnParameterInfo(MonoMethod method) { return(ParameterInfo.New(GetReturnType(method.mhandle), method, get_retval_marshal(method.mhandle))); }
internal static ParameterInfo GetReturnParameterInfo(MonoMethod method) { return(new ParameterInfo(MonoMethodInfo.GetReturnType(method.mhandle), method, MonoMethodInfo.get_retval_marshal(method.mhandle))); }
internal static extern int get_metadata_token(MonoMethod method);
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); Type returnType = this.ReturnType; if (MonoMethod.ShouldPrintFullName(returnType)) { stringBuilder.Append(returnType.ToString()); } else { stringBuilder.Append(returnType.Name); } stringBuilder.Append(" "); stringBuilder.Append(this.Name); if (this.IsGenericMethod) { Type[] genericArguments = this.GetGenericArguments(); stringBuilder.Append("["); for (int i = 0; i < genericArguments.Length; i++) { if (i > 0) { stringBuilder.Append(","); } stringBuilder.Append(genericArguments[i].Name); } stringBuilder.Append("]"); } stringBuilder.Append("("); ParameterInfo[] parameters = this.GetParameters(); for (int j = 0; j < parameters.Length; j++) { if (j > 0) { stringBuilder.Append(", "); } Type type = parameters[j].ParameterType; bool isByRef = type.IsByRef; if (isByRef) { type = type.GetElementType(); } if (MonoMethod.ShouldPrintFullName(type)) { stringBuilder.Append(type.ToString()); } else { stringBuilder.Append(type.Name); } if (isByRef) { stringBuilder.Append(" ByRef"); } } if ((this.CallingConvention & CallingConventions.VarArgs) != (CallingConventions)0) { if (parameters.Length > 0) { stringBuilder.Append(", "); } stringBuilder.Append("..."); } stringBuilder.Append(")"); return(stringBuilder.ToString()); }
internal static extern MonoMethod get_base_method (MonoMethod method, bool definition);
internal static MonoMethod get_base_method (MonoMethod method, bool definition) { throw new System.NotImplementedException(); }
internal void InitMessage (MonoMethod method, object [] out_args) { throw new System.NotImplementedException(); }
internal static MonoMethod get_base_method(MonoMethod method, bool definition) { throw new System.NotImplementedException(); }
internal static extern MonoMethod get_base_definition (MonoMethod method);
public override MethodInfo GetBaseDefinition() { return(MonoMethod.get_base_definition(this)); }
/* public override object Invoke (object obj, object[] parameters) { CreateDynMethod (); if (method == null) method = new MonoMethod (mhandle); return method.Invoke (obj, parameters); } */ public override object Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { try { CreateDynMethod (); if (method == null) method = new MonoMethod (mhandle); return method.Invoke (obj, parameters); } catch (MethodAccessException mae) { throw new TargetInvocationException ("Method cannot be invoked.", mae); } }
internal static extern MonoMethod get_base_definition(MonoMethod method);