public static void PrepareMethod(RuntimeMethodHandle method) { unsafe { _PrepareMethod(method.GetMethodInfo(), null, 0); } }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if MONO MethodBase m = GetMethodFromHandleInternalType(handle.Value, IntPtr.Zero); if (m == null) { throw new ArgumentException("The handle is invalid."); } #else MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo()); #endif Type declaringType = m.DeclaringType; if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), m, declaringType.GetGenericTypeDefinition())); } return(m); }
public static unsafe void PrepareMethod( RuntimeMethodHandle method, RuntimeTypeHandle[]?instantiation ) { IRuntimeMethodInfo methodInfo = method.GetMethodInfo(); if (methodInfo == null) { throw new ArgumentException( SR.InvalidOperation_HandleIsNotInitialized, nameof(method) ); } // defensive copy of user-provided array, per CopyRuntimeTypeHandles contract instantiation = (RuntimeTypeHandle[]?)instantiation?.Clone(); IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles( instantiation, out int length ); fixed(IntPtr *pInstantiation = instantiationHandles) { PrepareMethod(methodInfo.Value, pInstantiation, length); GC.KeepAlive(instantiation); GC.KeepAlive(methodInfo); } }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if !FEATURE_CORECLR && !MONO if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage)) { FrameworkEventSource.Log.BeginGetMethodFromHandle(); } #endif #if MONO MethodBase m = GetMethodFromHandleInternalType(handle.Value, declaringType.Value); if (m == null) { throw new ArgumentException("The handle is invalid."); } #else MethodBase m = RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo()); #endif #if !FEATURE_CORECLR && !MONO if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && declaringType != null && m != null) { FrameworkEventSource.Log.EndGetMethodFromHandle(declaringType.GetRuntimeType().GetFullNameForEtw(), m.GetFullNameForEtw()); } #endif return(m); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if !FEATURE_CORECLR if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage)) { FrameworkEventSource.Log.BeginGetMethodFromHandle(); } #endif MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo()); Type declaringType = m.DeclaringType; #if !FEATURE_CORECLR if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && declaringType != null) { FrameworkEventSource.Log.EndGetMethodFromHandle(declaringType.GetFullNameForEtw(), m.GetFullNameForEtw()); } #endif if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), m, declaringType.GetGenericTypeDefinition())); } return(m); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } return(RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo())); }
public static MethodBase?GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(SR.Argument_InvalidHandle); } return(RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo())); }
public static unsafe void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) { int num; fixed(IntPtr *ptrRef = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out num)) { _PrepareMethod(method.GetMethodInfo(), ptrRef, num); GC.KeepAlive(instantiation); } }
public static unsafe void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) { int length; fixed(IntPtr *pInstantiation = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out length)) { RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), pInstantiation, length); GC.KeepAlive((object)instantiation); } }
public unsafe static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) { int cInstantiation; IntPtr[] array = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out cInstantiation); fixed(IntPtr *ptr = array) { RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), ptr, cInstantiation); GC.KeepAlive(instantiation); } }
public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[]?instantiation) { unsafe { IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out int length); fixed(IntPtr *pInstantiation = instantiationHandles) { _PrepareMethod(method.GetMethodInfo(), pInstantiation, length); GC.KeepAlive(instantiation); } } }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } MethodBase methodBase = RuntimeType.GetMethodBase(handle.GetMethodInfo()); Type declaringType = methodBase.DeclaringType; if (declaringType != (Type)null && declaringType.IsGenericType) { throw new ArgumentException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), (object)methodBase, (object)declaringType.GetGenericTypeDefinition())); } return(methodBase); }
public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[]?instantiation) { // defensive copy of user-provided array, per CopyRuntimeTypeHandles contract instantiation = (RuntimeTypeHandle[]?)instantiation?.Clone(); unsafe { IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out int length); fixed(IntPtr *pInstantiation = instantiationHandles) { _PrepareMethod(method.GetMethodInfo(), pInstantiation, length); GC.KeepAlive(instantiation); } } }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if MONO MethodBase m = GetMethodFromHandleInternalType(handle.Value, declaringType.Value); if (m == null) { throw new ArgumentException("The handle is invalid."); } return(m); #else return(RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo())); #endif }
public int GetTokenFor(RuntimeMethodHandle method) { IRuntimeMethodInfo methodInfo = method.GetMethodInfo(); RuntimeMethodHandleInternal value = methodInfo.Value; if (methodInfo != null && !RuntimeMethodHandle.IsDynamicMethod(value)) { RuntimeType declaringType = RuntimeMethodHandle.GetDeclaringType(value); if (declaringType != null && RuntimeTypeHandle.HasInstantiation(declaringType)) { MethodBase methodBase = RuntimeType.GetMethodBase(methodInfo); Type genericTypeDefinition = methodBase.DeclaringType.GetGenericTypeDefinition(); throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGenericLcg"), methodBase, genericTypeDefinition)); } } this.m_tokens.Add(method); return(this.m_tokens.Count - 1 | 100663296); }
public int GetTokenFor(RuntimeMethodHandle method) { IRuntimeMethodInfo methodInfo = method.GetMethodInfo(); RuntimeMethodHandleInternal internal2 = methodInfo.Value; if ((methodInfo != null) && !RuntimeMethodHandle.IsDynamicMethod(internal2)) { RuntimeType declaringType = RuntimeMethodHandle.GetDeclaringType(internal2); if ((declaringType != null) && RuntimeTypeHandle.IsGenericType(declaringType)) { MethodBase methodBase = RuntimeType.GetMethodBase(methodInfo); Type genericTypeDefinition = methodBase.DeclaringType.GetGenericTypeDefinition(); throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGenericLcg"), new object[] { methodBase, genericTypeDefinition })); } } this.m_tokens.Add(method); return((this.m_tokens.Count - 1) | 0x6000000); }
public static MethodBase?GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(SR.Argument_InvalidHandle); } MethodBase?m = RuntimeType.GetMethodBase(handle.GetMethodInfo()); Type?declaringType = m?.DeclaringType; if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(SR.Format( SR.Argument_MethodDeclaringTypeGeneric, m, declaringType.GetGenericTypeDefinition())); } return(m); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo()); Type declaringType = m.DeclaringType; if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), m, declaringType.GetGenericTypeDefinition())); } return(m); }
public int GetTokenFor(RuntimeMethodHandle method) { IRuntimeMethodInfo methodReal = method.GetMethodInfo(); RuntimeMethodHandleInternal rmhi = methodReal.Value; if (methodReal != null && !RuntimeMethodHandle.IsDynamicMethod(rmhi)) { RuntimeType type = RuntimeMethodHandle.GetDeclaringType(rmhi); if ((type != null) && RuntimeTypeHandle.HasInstantiation(type)) { // Do we really need to retrieve this much info just to throw an exception? MethodBase m = RuntimeType.GetMethodBase(methodReal); Type t = m.DeclaringType.GetGenericTypeDefinition(); throw new ArgumentException(SR.Format(SR.Argument_MethodDeclaringTypeGenericLcg, m, t)); } } m_tokens.Add(method); return(m_tokens.Count - 1 | (int)MetadataTokenType.MethodDef); }
public static unsafe void PrepareMethod(RuntimeMethodHandle method) { RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), (IntPtr *)null, 0); }
public static void PrepareMethod(RuntimeMethodHandle method) { RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), null, 0); }