static StackObject *GetMethodFromHandle_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.RuntimeTypeHandle @declaringType = (System.RuntimeTypeHandle) typeof(System.RuntimeTypeHandle).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.RuntimeMethodHandle @handle = (System.RuntimeMethodHandle) typeof(System.RuntimeMethodHandle).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = System.Reflection.MethodBase.GetMethodFromHandle(@handle, @declaringType); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public ArgumentInfo(RuntimeMethodHandle getMethod, string name, bool optional, object defaultValue) { this.getMethod = getMethod; this.name = name; this.optional = optional; this.defaultValue = defaultValue; }
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 RedirectCallsState RedirectCalls(RuntimeMethodHandle from, RuntimeMethodHandle to) { // GetFunctionPointer enforces compilation of the method. var fptr1 = from.GetFunctionPointer(); var fptr2 = to.GetFunctionPointer(); return PatchJumpTo(fptr1, fptr2); }
/// <summary> /// Adds referenced symbol into the map. /// In case of redeclaration, the handle is added to the list. /// </summary> public static void DeclareRoutine(string name, RuntimeMethodHandle handle) { // TODO: W lock int index; if (NameToIndex.TryGetValue(name, out index)) { Debug.Assert(index != 0); if (index > 0) // already taken by user routine { throw new InvalidOperationException(); } ((ClrRoutineInfo)AppRoutines[-index - 1]).AddOverload(handle); } else { index = -AppRoutines.Count - 1; var routine = new ClrRoutineInfo(index, name, handle); AppRoutines.Add(routine); NameToIndex[name] = index; // register the routine within the extensions table ExtensionsAppContext.ExtensionsTable.AddRoutine(routine); } }
public unsafe OpenMethodResolver(RuntimeTypeHandle declaringTypeOfSlot, RuntimeMethodHandle gvmSlot, int handle) { _resolveType = GVMResolve; _methodHandleOrSlotOrCodePointer = *(IntPtr*)&gvmSlot; _declaringType = declaringTypeOfSlot; _handle = handle; }
private static FastInvoker GenerateDelegate(RuntimeMethodHandle methodHandle) { var methodInfo = (MethodInfo)MethodBase.GetMethodFromHandle(methodHandle); var dynamicMethod = new DynamicMethod(string.Empty, typeof(object), new[] { typeof(object), typeof(object[]) }, methodInfo.DeclaringType.Module); var il = dynamicMethod.GetILGenerator(); var ps = methodInfo.GetParameters(); var paramTypes = new Type[ps.Length]; for (var i = 0; i < paramTypes.Length; i++) { if (ps[i].ParameterType.IsByRef) { paramTypes[i] = ps[i].ParameterType.GetElementType(); } else { paramTypes[i] = ps[i].ParameterType; } } var locals = new LocalBuilder[paramTypes.Length]; for (var i = 0; i < paramTypes.Length; i++) { locals[i] = il.DeclareLocal(paramTypes[i], true); } for (var i = 0; i < paramTypes.Length; i++) { il.Emit(OpCodes.Ldarg_1); il.EmitFastInt(i); il.Emit(OpCodes.Ldelem_Ref); il.EmitCastToReference(paramTypes[i]); il.Emit(OpCodes.Stloc, locals[i]); } if (!methodInfo.IsStatic) { il.Emit(OpCodes.Ldarg_0); } for (var i = 0; i < paramTypes.Length; i++) { il.Emit(ps[i].ParameterType.IsByRef ? OpCodes.Ldloca_S : OpCodes.Ldloc, locals[i]); } il.EmitCall(methodInfo.IsStatic ? OpCodes.Call : OpCodes.Callvirt, methodInfo, null); if (methodInfo.ReturnType == typeof(void)) { il.Emit(OpCodes.Ldnull); } else { il.BoxIfNeeded(methodInfo.ReturnType); } il.Emit(OpCodes.Ret); var invoker = (FastInvoker)dynamicMethod.CreateDelegate(typeof(FastInvoker)); return invoker; }
internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandle rmh) { this.CompleteConstruction(null); if (this.PLS != null) { this.PLS.CheckDemand(demand, permToken, rmh); } return false; }
public static void _register_method(Symbol globname, System.RuntimeMethodHandle hndl, int nargs) { string ntmp = globname.v; comp_hash[ntmp] = System.Reflection.MethodBase.GetMethodFromHandle(hndl); comp_hash_nargs[ntmp] = (Object)nargs; comp_hash_f[ntmp] = null; Precompiler.symbols[globname] = makedelegate(globname); }
internal bool CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) { this.CompleteConstruction(null); if (this.PLS == null) { return false; } return this.PLS.CheckSetDemand(pset, rmh); }
internal RuntimeConstructorInfo(RuntimeMethodHandle handle, RuntimeTypeHandle declaringTypeHandle, RuntimeType.RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, System.Reflection.BindingFlags bindingFlags) { this.m_bindingFlags = bindingFlags; this.m_handle = handle; this.m_reflectedTypeCache = reflectedTypeCache; this.m_declaringType = declaringTypeHandle.GetRuntimeType(); this.m_parameters = null; this.m_toString = null; this.m_methodAttributes = methodAttributes; }
private static unsafe object CreateCaObject(Module module, RuntimeMethodHandle ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs) { int num; byte* ppBlob = (byte*) blob; byte* pEndBlob = (byte*) blobEnd; object obj2 = _CreateCaObject(module.ModuleHandle.Value, (void*) ctor.Value, &ppBlob, pEndBlob, &num); blob = (IntPtr) ppBlob; namedArgs = num; return obj2; }
public void SetUp () { if (!SecurityManager.SecurityEnabled) Assert.Ignore ("SecurityManager.SecurityEnabled is OFF"); // we do this in SetUp because we want the security // stack to be "normal/empty" so each unit test can // mess with it as it wishes handle = typeof (RuntimeMethodHandleCas).GetMethod ("SetUp").MethodHandle; }
public ProxyInvocation(Delegate callback, Func<Delegate, object[], object> callbackCaller, RuntimeMethodHandle methodHandle, RuntimeTypeHandle typeHandle, object proxy, object[] arguments) { this.callback = callback; this.callbackCaller = callbackCaller; this.methodHandle = methodHandle; this.typeHandle = typeHandle; this.proxy = proxy; this.arguments = arguments; }
protected MethodInvoker( RuntimeMethodHandle targetMethod, Func<object> instanceFactory ) { if ( instanceFactory == null ) { throw new ArgumentNullException( "instanceFactory" ); } Contract.EndContractBlock(); this._targetMethod = targetMethod; this._instanceFactory = instanceFactory; }
/// <summary> /// Returns the graph types for a method specified by a method handle. /// </summary> /// <param name="handle">The handle to the method.</param> /// <returns>The graph types for the method.</returns> public static Type[] GetGraphTypesFromMethodHandle(RuntimeMethodHandle handle) { return _types.GetOrAdd( handle, h => { MethodInfo method = (MethodInfo)MethodInfo.GetMethodFromHandle(h); var graphAttribute = method.GetCustomAttributes(false).OfType<DefaultGraphAttribute>().FirstOrDefault(); return graphAttribute.GraphTypes; }); }
public unsafe SignatureStruct(RuntimeMethodHandle method, RuntimeTypeHandle[] arguments, RuntimeTypeHandle returnType, CallingConventions callingConvention) { this.m_pMethod = method; this.m_arguments = arguments; this.m_returnTypeORfieldType = returnType; this.m_managedCallingConvention = callingConvention; this.m_sig = null; this.m_pCallTarget = null; this.m_csig = 0; this.m_numVirtualFixedArgs = 0; this.m_64bitpad = 0; this.m_declaringType = new RuntimeTypeHandle(); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } MethodBase methodBase = RuntimeType.GetMethodBase(handle); if ((methodBase.DeclaringType != null) && methodBase.DeclaringType.IsGenericType) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), new object[] { methodBase, methodBase.DeclaringType.GetGenericTypeDefinition() })); } return methodBase; }
internal static unsafe IntPtr GVMLookupForSlot(RuntimeTypeHandle type, RuntimeMethodHandle slot) { RuntimeTypeHandle declaringTypeHandle; MethodNameAndSignature nameAndSignature; RuntimeTypeHandle[] genericMethodArgs; if (!RuntimeAugments.TypeLoaderCallbacks.GetRuntimeMethodHandleComponents(slot, out declaringTypeHandle, out nameAndSignature, out genericMethodArgs)) { System.Diagnostics.Debug.Assert(false); return IntPtr.Zero; } return GVMLookupForSlotWorker(type, declaringTypeHandle, genericMethodArgs, nameAndSignature); }
// // This overload of GetMethodForHandle only accepts handles for methods declared on non-generic types (the method, however, // can be an instance of a generic method.) To resolve handles for methods declared on generic types, you must pass // the declaring type explicitly using the two-argument overload of GetMethodFromHandle. // // This is a vestige from desktop generic sharing that got itself enshrined in the code generated by the C# compiler for Linq Expressions. // public sealed override MethodBase GetMethodFromHandle(RuntimeMethodHandle runtimeMethodHandle) { ExecutionEnvironment executionEnvironment = ReflectionCoreExecution.ExecutionEnvironment; MethodHandle methodHandle; RuntimeTypeHandle declaringTypeHandle; RuntimeTypeHandle[] genericMethodTypeArgumentHandles; if (!executionEnvironment.TryGetMethodFromHandle(runtimeMethodHandle, out declaringTypeHandle, out methodHandle, out genericMethodTypeArgumentHandles)) throw new ArgumentException(SR.Argument_InvalidHandle); MethodBase methodBase = ReflectionCoreExecution.ExecutionDomain.GetMethod(declaringTypeHandle, methodHandle, genericMethodTypeArgumentHandles); if (methodBase.DeclaringType.IsConstructedGenericType) // For compat with desktop, insist that the caller pass us the declaring type to resolve members of generic types. throw new ArgumentException(SR.Format(SR.Argument_MethodDeclaringTypeGeneric, methodBase)); return methodBase; }
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 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; }
object Internal_OnCall(RuntimeMethodHandle rmh, object thisObj, object[] args) { var method = MethodBase.GetMethodFromHandle(rmh); var typeName = method.DeclaringType.FullName; var methodName = method.Name; Debug.Log(String.Format("{0}.{1}(...)", typeName, methodName)); foreach (var cb in callbacks) { var o = cb(typeName, methodName, thisObj, args); if (o != null) { return o; } } return null; }
internal static Exception MakeSecurityException(AssemblyName asmName, Evidence asmEvidence, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) { // See if we need to throw a HostProtectionException instead HostProtectionPermission hostProtectionPerm = permThatFailed as HostProtectionPermission; if(hostProtectionPerm != null) return new HostProtectionException(GetResString("HostProtection_HostProtection"), HostProtectionPermission.protectedResources, hostProtectionPerm.Resources); // Produce relevant strings String message = ""; MethodInfo method = null; try { if(granted == null && refused == null && demand == null) { message = GetResString("Security_NoAPTCA"); } else { if(demand != null && demand is IPermission) message = String.Format(CultureInfo.InvariantCulture, GetResString("Security_Generic"), demand.GetType().AssemblyQualifiedName ); else if (permThatFailed != null) message = String.Format(CultureInfo.InvariantCulture, GetResString("Security_Generic"), permThatFailed.GetType().AssemblyQualifiedName); else message = GetResString("Security_GenericNoType"); } method = SecurityRuntime.GetMethodInfo(rmh); } catch(Exception e) { // Environment.GetResourceString will throw if we are ReadyForAbort (thread abort). (We shouldn't do a BCLDebug.Assert in this case or it will lock up the thread.) if(e is System.Threading.ThreadAbortException) throw; } /* catch(System.Threading.ThreadAbortException) { // Environment.GetResourceString will throw if we are ReadyForAbort (thread abort). (We shouldn't do a BCLDebug.Assert in this case or it will lock up the thread.) throw; } catch { } */ // make the exception object return new SecurityException(message, asmName, granted, refused, method, action, demand, permThatFailed, asmEvidence); }
/// <summary> /// Get a <see cref="MethodDescriptor"/> for a <see cref="RuntimeTypeHandle"/>. /// </summary> /// <param name="runtimeMethodHandle">The <see cref="RuntimeTypeHandle"/> for which to get the <see cref="MethodDescriptor"/>.</param> /// <returns>A <see cref="MethodDescriptor"/> corresponding to <paramref name="runtimeMethodHandle"/>.</returns> public static MethodDescriptor GetMethod(RuntimeMethodHandle runtimeMethodHandle) { MethodDescriptor methodDescriptor; var success = methodCache.TryGetValue(runtimeMethodHandle, out methodDescriptor); if (!success) { lock (methodCacheDictionaryLock) { if (!methodCache.TryGetValue(runtimeMethodHandle, out methodDescriptor)) { methodDescriptor = new MethodDescriptor(runtimeMethodHandle); methodCache.Add(runtimeMethodHandle, methodDescriptor); } } } return methodDescriptor; }
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); }
internal ProjectionProperty(PropertyInfo property, ProjectionStructureType declaringType, ProjectionPropertyCollection properties, ProjectionFactory factory, ITraitResolution resolution) { this.name = property.Name; this.declaringType = declaringType; this.propertyType = factory.GetProjectionTypeUnsafe(property.PropertyType); this.accessors = new IPropertyAccessor[4]; // factory.Providers.Count var getter = property.GetGetMethod(); var setter = property.GetSetMethod(); if (getter != null) { getterHandle = getter.MethodHandle; flags |= Flags.CanRead; } if (setter != null) { setterHandle = setter.MethodHandle; flags |= Flags.CanWrite; } var aggregator = new ProjectionPropertyTraitAggregator(this, properties); resolution.ProvidePropertyTraits(this, property, aggregator); this.aggregator = aggregator; this.overrides = aggregator.Overrides; }
// // This overload of GetMethodHandle can handle all method handles. // public sealed override MethodBase GetMethodFromHandle(RuntimeMethodHandle runtimeMethodHandle, RuntimeTypeHandle declaringTypeHandle) { ExecutionEnvironment executionEnvironment = ReflectionCoreExecution.ExecutionEnvironment; MethodHandle methodHandle; RuntimeTypeHandle[] genericMethodTypeArgumentHandles; if (!executionEnvironment.TryGetMethodFromHandleAndType(runtimeMethodHandle, declaringTypeHandle, out methodHandle, out genericMethodTypeArgumentHandles)) { // This may be a method declared on a non-generic type: this api accepts that too so try the other table. RuntimeTypeHandle actualDeclaringTypeHandle; if (!executionEnvironment.TryGetMethodFromHandle(runtimeMethodHandle, out actualDeclaringTypeHandle, out methodHandle, out genericMethodTypeArgumentHandles)) throw new ArgumentException(SR.Argument_InvalidHandle); if (!actualDeclaringTypeHandle.Equals(declaringTypeHandle)) throw new ArgumentException(SR.Format(SR.Argument_ResolveMethodHandle, declaringTypeHandle.GetTypeForRuntimeTypeHandle(), actualDeclaringTypeHandle.GetTypeForRuntimeTypeHandle())); } MethodBase methodBase = ReflectionCoreExecution.ExecutionDomain.GetMethod(declaringTypeHandle, methodHandle, genericMethodTypeArgumentHandles); return methodBase; }
// Based on LogMan's answer to this StackOverflow question: // http://stackoverflow.com/questions/7299097/dynamically-replace-the-contents-of-a-c-sharp-method public static void InjectMethod(RuntimeMethodHandle methodToInject, RuntimeMethodHandle methodToReplace) { RuntimeHelpers.PrepareMethod(methodToReplace); RuntimeHelpers.PrepareMethod(methodToInject); unsafe { if (IntPtr.Size == 4) { int* inj = (int*)methodToInject.Value.ToPointer() + 2; int* tar = (int*)methodToReplace.Value.ToPointer() + 2; *tar = *inj; } else { long* inj = (long*)methodToInject.Value.ToPointer() + 1; long* tar = (long*)methodToReplace.Value.ToPointer() + 1; *tar = *inj; } } }
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; }
/// <summary> /// Initialize a new instance of <see cref="MethodDescriptor"/> class. /// </summary> /// <param name="runtimeMethodHandle">The <see cref="System.RuntimeMethodHandle"/> of the <see cref="MethodBase"/> to wrap.</param> internal MethodDescriptor(RuntimeMethodHandle runtimeMethodHandle) { var method = MethodBase.GetMethodFromHandle(runtimeMethodHandle); if (TypeExtensions.IsPropertyMethod(method)) { //Dont throw for indexer properties //TODO: hack should be a better way of doing this if ((method.Name != "get_Item") && !method.Name.StartsWith("set_Item")) { throw new ArgumentException("Creating a MethodDescriptor for a property is not supported.", "runtimeMethodHandle"); } } Parameters = new ParameterCollection(this); RuntimeMethodHandle = runtimeMethodHandle; Name = method.Name; IsStatic = method.IsStatic; AppendParameters(method); ProcessInterfaces(method); ProcessBaseMethods(method); Parameters.SetToReadOnly(); }
internal static IRuntimeMethodInfo GetCurrentMethod(ref StackCrawlMark stackMark) { return(RuntimeMethodHandle._GetCurrentMethod(ref stackMark)); }
// This function is known to the compiler. protected void InitializeClosedInstanceWithGVMResolution(object firstParameter, RuntimeMethodHandle tokenOfGenericVirtualMethod) { if (firstParameter == null) { throw new ArgumentException(SR.Arg_DlgtNullInst); } IntPtr functionResolution = TypeLoaderExports.GVMLookupForSlot(firstParameter, tokenOfGenericVirtualMethod); if (functionResolution == IntPtr.Zero) { // TODO! What to do when GVM resolution fails. Should never happen throw new InvalidOperationException(); } if (!FunctionPointerOps.IsGenericMethodPointer(functionResolution)) { m_functionPointer = functionResolution; m_firstParameter = firstParameter; } else { m_firstParameter = this; m_functionPointer = GetThunk(ClosedInstanceThunkOverGenericMethod); m_extraFunctionPointerOrData = functionResolution; m_helperObject = firstParameter; } return; }
// // internal implementation details (FCALLS and utilities) // // V2 internal API. // This is Critical because it skips the security check when creating the delegate. internal unsafe static Delegate CreateDelegateNoSecurityCheck(Type type, Object target, RuntimeMethodHandle method) { // Validate the parameters. if (type == null) { throw new ArgumentNullException(nameof(type)); } if (method.IsNullHandle()) { throw new ArgumentNullException(nameof(method)); } RuntimeType rtType = type as RuntimeType; if (rtType == null) { throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type)); } if (!rtType.IsDelegate()) { throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type)); } // Initialize the method... Delegate d = InternalAlloc(rtType); // This is a new internal API added in Whidbey. Currently it's only // used by the dynamic method code to generate a wrapper delegate. // Allow flexible binding options since the target method is // unambiguously provided to us. if (!d.BindToMethodInfo(target, method.GetMethodInfo(), RuntimeMethodHandle.GetDeclaringType(method.GetMethodInfo()), DelegateBindingFlags.RelaxedSignature | DelegateBindingFlags.SkipSecurityChecks)) { throw new ArgumentException(SR.Arg_DlgtTargMeth); } return(d); }
public bool Equals(RuntimeMethodHandle handle) { return(handle.m_ptr == this.m_ptr); }
internal static unsafe Utf8String GetUtf8Name(RuntimeMethodHandleInternal method) { return(new Utf8String(RuntimeMethodHandle._GetUtf8Name(method))); }
internal static bool IsTokenSecurityTransparent(Module module, int metaDataToken) { return(RuntimeMethodHandle._IsTokenSecurityTransparent(module.ModuleHandle.GetRuntimeModule(), metaDataToken)); }
internal static bool IsSecurityTransparent(IRuntimeMethodInfo method) { return(RuntimeMethodHandle._IsSecurityTransparent(method)); }
public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
internal static bool IsSecuritySafeCritical(IRuntimeMethodInfo method) { return(RuntimeMethodHandle._IsSecuritySafeCritical(method)); }
public static void _add_dep(System.RuntimeMethodHandle hndl) { deplist = new Pair((object)System.Reflection.MethodBase.GetMethodFromHandle(hndl), (object)deplist); }
internal static void PerformSecurityCheck(object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags) { RuntimeMethodHandle.PerformSecurityCheck(obj, method.Value, parent, invocationFlags); GC.KeepAlive((object)method); }
public bool Equals(RuntimeMethodHandle handle) { return(handle.Value == this.Value); }
public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle) { throw null; }
internal static INVOCATION_FLAGS GetSecurityFlags(IRuntimeMethodInfo handle) { return((INVOCATION_FLAGS)RuntimeMethodHandle.GetSpecialSecurityFlags(handle)); }
private static IntPtr GetValueInternal(RuntimeMethodHandle rmh) { return(rmh.Value); }
internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method) { RuntimeType[] o = (RuntimeType[])null; RuntimeMethodHandle.GetMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack <RuntimeType[]>(ref o), true); return(o); }