157 internal MethodBuilder(
string name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
Type[] returnTypeRequiredCustomModifiers,
Type[] returnTypeOptionalCustomModifiers,
Type[] parameterTypes,
Type[][] parameterTypeRequiredCustomModifiers,
Type[][] parameterTypeOptionalCustomModifiers,
ModuleBuilder mod, [DynamicallyAccessedMembers(
DynamicallyAccessedMemberTypes.All)]
TypeBuilder type)
163 if (name.Length == 0)
175 if (parameterTypes !=
null)
177 foreach (
Type type2
in parameterTypes)
198 if (parameterTypes !=
null)
251 int[] filterAddresses =
exceptions[i].GetFilterAddresses();
252 int[] catchAddresses =
exceptions[i].GetCatchAddresses();
253 int[] catchEndAddresses =
exceptions[i].GetCatchEndAddresses();
255 int numberOfCatches =
exceptions[i].GetNumberOfCatches();
256 int startAddress =
exceptions[i].GetStartAddress();
257 int endAddress =
exceptions[i].GetEndAddress();
258 int[] exceptionTypes =
exceptions[i].GetExceptionTypes();
259 for (
int j = 0; j < numberOfCatches; j++)
261 int exceptionTypeToken = 0;
262 if (catchClass[j] !=
null)
266 switch (exceptionTypes[j])
271 m_exceptions[num++] =
new ExceptionHandler(startAddress, endAddress, filterAddresses[j], catchAddresses[j], catchEndAddresses[j], exceptionTypes[j], exceptionTypeToken);
274 m_exceptions[num++] =
new ExceptionHandler(startAddress,
exceptions[i].GetFinallyEndAddress(), filterAddresses[j], catchAddresses[j], catchEndAddresses[j], exceptionTypes[j], exceptionTypeToken);
304 return methodInfo.ReturnType;
308 return constructorInfo.GetReturnType();
373 for (
int i = 0; i < excp.Length; i++)
492 [RequiresUnreferencedCode(
"If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
504 if (names.Length == 0)
512 for (
int i = 0; i < names.Length; i++)
514 if (names[i] ==
null)
525 for (
int j = 0; j < names.Length; j++)
559 if (methodBuilder ==
this)
564 m_containingType.m_lastTokenizedMethod = i;
593 SetSignature(
null,
null,
null, parameterTypes,
null,
null);
602 public void SetSignature(
Type? returnType,
Type[]? returnTypeRequiredCustomModifiers,
Type[]? returnTypeOptionalCustomModifiers,
Type[]? parameterTypes,
Type[][]? parameterTypeRequiredCustomModifiers,
Type[][]? parameterTypeOptionalCustomModifiers)
611 if (returnType !=
null)
615 if (parameterTypes !=
null)
682 if ((
object)con ==
null)
686 if (binaryAttribute ==
null)
700 if (customBuilder ==
null)
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
static void CheckContext(params Type[][] typess)
void CreateCustomAttribute(ModuleBuilder mod, int tkOwner)
MethodInfo m_methodBuilder
SignatureHelper m_localSignature
__ExceptionInfo[] GetExceptions()
static MethodInfo MakeGenericMethod(MethodInfo method, Type[] inst)
override bool ContainsGenericParameters
MethodImplAttributes m_dwMethodImplFlags
void SetImplementationFlags(MethodImplAttributes attributes)
static bool IsKnownCA(ConstructorInfo con)
Type[][] m_parameterTypeOptionalCustomModifiers
override? Type DeclaringType
GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
void SetSignature(Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
override bool IsSecurityCritical
override bool IsGenericMethodDefinition
override object[] GetCustomAttributes(Type attributeType, bool inherit)
override MethodInfo GetBaseDefinition()
TypeBuilder GetTypeBuilder()
override bool IsSecurityTransparent
void ThrowIfShouldNotHaveBody()
void ReleaseBakedStructures()
override RuntimeMethodHandle MethodHandle
ILGenerator GetILGenerator(int size)
void SetCustomAttribute(CustomAttributeBuilder customBuilder)
override int GetHashCode()
static Type GetMethodBaseReturnType(MethodBase method)
override ICustomAttributeProvider ReturnTypeCustomAttributes
override MethodInfo MakeGenericMethod(params Type[] typeArguments)
byte[] GetLocalSignature(out int signatureLength)
override ParameterInfo[] GetParameters()
SignatureHelper m_signature
ILGenerator m_ilGenerator
SignatureHelper GetMethodSignature()
override? Type ReflectedType
ModuleBuilder GetModuleBuilder()
override bool IsGenericMethod
override ParameterInfo ReturnParameter
void CreateMethodBodyHelper(ILGenerator il)
void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
override MethodAttributes Attributes
override bool Equals(object? obj)
GenericTypeParameterBuilder[] m_inst
override bool IsSecuritySafeCritical
LocalSymInfo m_localSymInfo
Type[] m_returnTypeOptionalCustomModifiers
override Type[] GetParameterTypes()
int ExceptionHandlerCount
MethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TypeBuilder type)
ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string? strParamName)
override Type[] GetGenericArguments()
override object Invoke(object? obj, BindingFlags invokeAttr, Binder? binder, object?[]? parameters, CultureInfo? culture)
void SetReturnType(Type? returnType)
static int CalculateNumberOfExceptions(__ExceptionInfo[] excp)
void ParseCA(ConstructorInfo con)
ExceptionHandler[] m_exceptions
override MethodInfo GetGenericMethodDefinition()
override MethodImplAttributes GetMethodImplementationFlags()
readonly ModuleBuilder m_module
TypeBuilder m_containingType
void SetParameters(params Type[] parameterTypes)
override string ToString()
override bool IsDefined(Type attributeType, bool inherit)
override object[] GetCustomAttributes(bool inherit)
Type[][] m_parameterTypeRequiredCustomModifiers
ILGenerator GetILGenerator()
Type[] m_returnTypeRequiredCustomModifiers
readonly MethodAttributes m_iAttributes
readonly CallingConventions m_callingConvention
ExceptionHandler[] GetExceptionHandlers()
int GetConstructorToken(ConstructorInfo con)
int GetTypeTokenInternal(Type type)
override bool Equals(object? obj)
byte[] InternalGetSignature(out int length)
static SignatureHelper GetLocalVarSigHelper()
static SignatureHelper GetMethodSigHelper(Module? mod, Type? returnType, Type[]? parameterTypes)
bool m_isHiddenGlobalType
static void SetMethodImpl(QCallModule module, int tkMethod, MethodImplAttributes MethodImplAttributes)
RuntimeType BakedRuntimeType
static int DefineMethod(QCallModule module, int tkParent, string name, byte[] signature, int sigLength, MethodAttributes attributes)
int m_lastTokenizedMethod
override int MetadataToken
static void DefineCustomAttribute(QCallModule module, int tkAssociate, int tkConstructor, byte[] attr, int attrLength)
List< MethodBuilder > m_listMethods
static MethodInfo GetMethod(Type type, MethodInfo method)
ParameterInfo[] GetParameters()
virtual ParameterInfo ReturnParameter
static string InvalidOperation_MethodHasBody
static string Arg_NoStaticVirtual
static string ArgumentOutOfRange_ParamSequence
static string InvalidOperation_GenericParametersAlreadySet
static string InvalidOperation_MethodBuilderBaked
static string InvalidOperation_BadILGeneratorUsage
static string NotSupported_DynamicModule
static string Argument_IllegalName
static string InvalidOperation_TypeNotCreated
static string InvalidOperation_ShouldNotHaveMethodBody
static string InvalidOperation_OpenLocalVariableScope
static string Arg_EmptyArray
static string Argument_EmptyName
StringBuilder AppendLine()
override string ToString()
StringBuilder Append(char value, int repeatCount)
static readonly Type[] EmptyTypes
DynamicallyAccessedMemberTypes