public RuntimeMethodHandle GetRuntimeMethodHandle(Type[] genericArgs) { Debug.Assert(genericArgs == null || genericArgs.Length > 0); RuntimeTypeHandle[] genericArgHandles; if (genericArgs != null) { genericArgHandles = new RuntimeTypeHandle[genericArgs.Length]; for (int i = 0; i < genericArgHandles.Length; i++) { genericArgHandles[i] = genericArgs[i].TypeHandle; } } else { genericArgHandles = null; } TypeManagerHandle typeManager = TypeLoaderEnvironment.Instance.ModuleList.GetModuleForMetadataReader(Reader); return(TypeLoaderEnvironment.Instance.GetRuntimeMethodHandleForComponents( DeclaringType.TypeHandle, Name, RuntimeSignature.CreateFromMethodHandle(typeManager, MethodHandle.AsInt()), genericArgHandles)); }
public RuntimeMethodHandle GetRuntimeMethodHandle(Type[] genericArgs) { Debug.Assert(genericArgs == null || genericArgs.Length > 0); RuntimeTypeHandle[] genericArgHandles; if (genericArgs != null) { genericArgHandles = new RuntimeTypeHandle[genericArgs.Length]; for (int i = 0; i < genericArgHandles.Length; i++) { genericArgHandles[i] = genericArgs[i].TypeHandle; } } else { genericArgHandles = null; } IntPtr dynamicModule = ModuleList.Instance.GetModuleInfoForMetadataReader(Reader).DynamicModulePtrAsIntPtr; return(TypeLoaderEnvironment.Instance.GetRuntimeMethodHandleForComponents( DeclaringType.TypeHandle, Name, RuntimeSignature.CreateFromMethodHandle(dynamicModule, MetadataToken), genericArgHandles)); }
public static bool TryCreate(MethodDesc method, out RuntimeSignature methodSignature) { #if SUPPORTS_NATIVE_METADATA_TYPE_LOADING MethodDesc typicalMethod = method.GetTypicalMethodDefinition(); if (typicalMethod is TypeSystem.NativeFormat.NativeFormatMethod) { TypeSystem.NativeFormat.NativeFormatMethod nativeFormatMethod = (TypeSystem.NativeFormat.NativeFormatMethod)typicalMethod; methodSignature = RuntimeSignature.CreateFromMethodHandle(nativeFormatMethod.MetadataUnit.RuntimeModule, nativeFormatMethod.Handle.ToInt()); return(true); } #if ECMA_METADATA_SUPPORT if (typicalMethod is TypeSystem.Ecma.EcmaMethod) { unsafe { TypeSystem.Ecma.EcmaMethod ecmaMethod = (TypeSystem.Ecma.EcmaMethod)typicalMethod; methodSignature = RuntimeSignature.CreateFromMethodHandle(new IntPtr(ecmaMethod.Module.RuntimeModuleInfo.DynamicModulePtr), System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(ecmaMethod.Handle)); } return(true); } #endif #endif methodSignature = default(RuntimeSignature); return(false); }
public RuntimeSignature GetSignature(Internal.Metadata.NativeFormat.Handle token) { switch (token.HandleType) { // These are the only valid token types for creating a method signature case Internal.Metadata.NativeFormat.HandleType.Method: case Internal.Metadata.NativeFormat.HandleType.MemberReference: case Internal.Metadata.NativeFormat.HandleType.QualifiedMethod: case Internal.Metadata.NativeFormat.HandleType.MethodInstantiation: case Internal.Metadata.NativeFormat.HandleType.MethodSignature: break; default: Environment.FailFast("Unknown and invalid handle type"); break; } return(RuntimeSignature.CreateFromMethodHandle(_metadataUnit.RuntimeModule, token.ToInt())); }