16 [__DynamicallyInvokable]
19 private IRuntimeMethodInfo m_value;
34 return m_value.Value.Value;
38 internal static IRuntimeMethodInfo EnsureNonNullMethodInfo(IRuntimeMethodInfo method)
47 internal RuntimeMethodHandle(IRuntimeMethodInfo method)
52 internal IRuntimeMethodInfo GetMethodInfo()
58 private static IntPtr GetValueInternal(RuntimeMethodHandle rmh)
68 throw new ArgumentNullException(
"info");
71 RuntimeMethodHandle methodHandle = methodBase.
MethodHandle;
72 m_value = methodHandle.m_value;
97 MethodBase methodBase = RuntimeType.GetMethodBase(m_value);
98 info.AddValue(
"MethodObj", methodBase, typeof(
MethodBase));
103 [SecuritySafeCritical]
104 [__DynamicallyInvokable]
114 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
115 [SecuritySafeCritical]
116 [__DynamicallyInvokable]
131 [__DynamicallyInvokable]
134 return left.
Equals(right);
142 [__DynamicallyInvokable]
145 return !left.
Equals(right);
152 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
153 [SecuritySafeCritical]
154 [__DynamicallyInvokable]
160 internal bool IsNullHandle()
162 return m_value ==
null;
167 [SuppressUnmanagedCodeSecurity]
178 return functionPointer;
183 internal static extern void CheckLinktimeDemands(IRuntimeMethodInfo method, RuntimeModule module,
bool isDecoratedTargetSecurityTransparent);
187 [SuppressUnmanagedCodeSecurity]
188 internal static extern bool IsCAVisibleFromDecoratedType(
RuntimeTypeHandle attrTypeHandle, IRuntimeMethodInfo attrCtor,
RuntimeTypeHandle sourceTypeHandle, RuntimeModule sourceModule);
192 private static extern IRuntimeMethodInfo _GetCurrentMethod(ref StackCrawlMark stackMark);
194 [SecuritySafeCritical]
195 internal static IRuntimeMethodInfo GetCurrentMethod(ref StackCrawlMark stackMark)
197 return _GetCurrentMethod(ref stackMark);
202 internal static extern MethodAttributes GetAttributes(RuntimeMethodHandleInternal method);
208 GC.KeepAlive(method);
213 [SecuritySafeCritical]
218 [SuppressUnmanagedCodeSecurity]
219 private static extern void ConstructInstantiation(IRuntimeMethodInfo method, TypeNameFormatFlags format, StringHandleOnStack retString);
221 [SecuritySafeCritical]
222 internal static string ConstructInstantiation(IRuntimeMethodInfo method, TypeNameFormatFlags format)
225 ConstructInstantiation(EnsureNonNullMethodInfo(method), format, JitHelpers.GetStringHandleOnStack(ref s));
231 internal static extern RuntimeType GetDeclaringType(RuntimeMethodHandleInternal method);
233 [SecuritySafeCritical]
234 internal static RuntimeType GetDeclaringType(IRuntimeMethodInfo method)
236 RuntimeType declaringType = GetDeclaringType(method.Value);
237 GC.KeepAlive(method);
238 return declaringType;
243 internal static extern int GetSlot(RuntimeMethodHandleInternal method);
246 internal static int GetSlot(IRuntimeMethodInfo method)
248 int slot = GetSlot(method.Value);
249 GC.KeepAlive(method);
255 internal static extern int GetMethodDef(IRuntimeMethodInfo method);
259 internal static extern string GetName(RuntimeMethodHandleInternal method);
262 internal static string GetName(IRuntimeMethodInfo method)
264 string name = GetName(method.Value);
265 GC.KeepAlive(method);
271 private unsafe
static extern void* _GetUtf8Name(RuntimeMethodHandleInternal method);
274 internal unsafe
static Utf8String GetUtf8Name(RuntimeMethodHandleInternal method)
276 return new Utf8String(_GetUtf8Name(method));
281 internal static extern bool MatchesNameHash(RuntimeMethodHandleInternal method, uint hash);
284 [SecuritySafeCritical]
285 [DebuggerStepThrough]
287 internal static extern object InvokeMethod(
object target,
object[] arguments, Signature sig,
bool constructor);
290 internal static INVOCATION_FLAGS GetSecurityFlags(IRuntimeMethodInfo handle)
292 return (INVOCATION_FLAGS)GetSpecialSecurityFlags(handle);
297 internal static extern uint GetSpecialSecurityFlags(IRuntimeMethodInfo method);
301 internal static extern void PerformSecurityCheck(
object obj, RuntimeMethodHandleInternal method, RuntimeType parent, uint invocationFlags);
304 internal static void PerformSecurityCheck(
object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags)
306 PerformSecurityCheck(obj, method.Value, parent, invocationFlags);
307 GC.KeepAlive(method);
311 [SecuritySafeCritical]
312 [DebuggerStepThrough]
318 internal static extern bool _IsTokenSecurityTransparent(RuntimeModule module,
int metaDataToken);
321 internal static bool IsTokenSecurityTransparent(
Module module,
int metaDataToken)
323 return _IsTokenSecurityTransparent(module.
ModuleHandle.GetRuntimeModule(), metaDataToken);
328 [SuppressUnmanagedCodeSecurity]
330 private static extern bool _IsSecurityCritical(IRuntimeMethodInfo method);
332 [SecuritySafeCritical]
333 internal static bool IsSecurityCritical(IRuntimeMethodInfo method)
335 return _IsSecurityCritical(method);
340 [SuppressUnmanagedCodeSecurity]
342 private static extern bool _IsSecuritySafeCritical(IRuntimeMethodInfo method);
344 [SecuritySafeCritical]
345 internal static bool IsSecuritySafeCritical(IRuntimeMethodInfo method)
347 return _IsSecuritySafeCritical(method);
352 [SuppressUnmanagedCodeSecurity]
354 private static extern bool _IsSecurityTransparent(IRuntimeMethodInfo method);
356 [SecuritySafeCritical]
357 internal static bool IsSecurityTransparent(IRuntimeMethodInfo method)
359 return _IsSecurityTransparent(method);
364 [SuppressUnmanagedCodeSecurity]
365 private static extern void GetMethodInstantiation(RuntimeMethodHandleInternal method, ObjectHandleOnStack types,
bool fAsRuntimeTypeArray);
367 [SecuritySafeCritical]
368 internal static RuntimeType[] GetMethodInstantiationInternal(IRuntimeMethodInfo method)
370 RuntimeType[] o =
null;
371 GetMethodInstantiation(EnsureNonNullMethodInfo(method).
Value, JitHelpers.GetObjectHandleOnStack(ref o), fAsRuntimeTypeArray:
true);
372 GC.KeepAlive(method);
376 [SecuritySafeCritical]
377 internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
379 RuntimeType[] o =
null;
380 GetMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack(ref o), fAsRuntimeTypeArray:
true);
384 [SecuritySafeCritical]
385 internal static Type[] GetMethodInstantiationPublic(IRuntimeMethodInfo method)
387 RuntimeType[] o =
null;
388 GetMethodInstantiation(EnsureNonNullMethodInfo(method).
Value, JitHelpers.GetObjectHandleOnStack(ref o), fAsRuntimeTypeArray:
false);
389 GC.KeepAlive(method);
395 internal static extern bool HasMethodInstantiation(RuntimeMethodHandleInternal method);
397 [SecuritySafeCritical]
398 internal static bool HasMethodInstantiation(IRuntimeMethodInfo method)
400 bool result = HasMethodInstantiation(method.Value);
401 GC.KeepAlive(method);
407 internal static extern RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation);
411 internal static extern RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType);
415 internal static extern bool IsGenericMethodDefinition(RuntimeMethodHandleInternal method);
417 [SecuritySafeCritical]
418 internal static bool IsGenericMethodDefinition(IRuntimeMethodInfo method)
420 bool result = IsGenericMethodDefinition(method.Value);
421 GC.KeepAlive(method);
426 [SecuritySafeCritical]
427 internal static extern bool IsTypicalMethodDefinition(IRuntimeMethodInfo method);
431 [SuppressUnmanagedCodeSecurity]
432 private static extern void GetTypicalMethodDefinition(IRuntimeMethodInfo method, ObjectHandleOnStack outMethod);
434 [SecuritySafeCritical]
435 internal static IRuntimeMethodInfo GetTypicalMethodDefinition(IRuntimeMethodInfo method)
437 if (!IsTypicalMethodDefinition(method))
439 GetTypicalMethodDefinition(method, JitHelpers.GetObjectHandleOnStack(ref method));
446 [SuppressUnmanagedCodeSecurity]
447 private static extern void StripMethodInstantiation(IRuntimeMethodInfo method, ObjectHandleOnStack outMethod);
449 [SecuritySafeCritical]
450 internal static IRuntimeMethodInfo StripMethodInstantiation(IRuntimeMethodInfo method)
452 IRuntimeMethodInfo o = method;
453 StripMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack(ref o));
458 [SecuritySafeCritical]
459 internal static extern bool IsDynamicMethod(RuntimeMethodHandleInternal method);
463 [SuppressUnmanagedCodeSecurity]
464 internal static extern void Destroy(RuntimeMethodHandleInternal method);
467 [SecuritySafeCritical]
468 internal static extern Resolver GetResolver(RuntimeMethodHandleInternal method);
472 [SuppressUnmanagedCodeSecurity]
473 private static extern void GetCallerType(StackCrawlMarkHandle stackMark, ObjectHandleOnStack retType);
475 [SecuritySafeCritical]
476 internal static RuntimeType GetCallerType(ref StackCrawlMark stackMark)
478 RuntimeType o =
null;
479 GetCallerType(JitHelpers.GetStackCrawlMarkHandle(ref stackMark), JitHelpers.GetObjectHandleOnStack(ref o));
484 [SecuritySafeCritical]
485 internal static extern MethodBody GetMethodBody(IRuntimeMethodInfo method, RuntimeType declaringType);
489 internal static extern bool IsConstructor(RuntimeMethodHandleInternal method);
493 internal static extern LoaderAllocator GetLoaderAllocator(RuntimeMethodHandleInternal method);
IntPtr GetFunctionPointer()
Obtains a pointer to the method represented by this instance.
Performs reflection on a module.
static bool operator==(RuntimeMethodHandle left, RuntimeMethodHandle right)
Indicates whether two instances of T:System.RuntimeMethodHandle are equal.
MethodAttributes
Specifies flags for method attributes. These flags are defined in the corhdr.h file.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
MethodImplAttributes
Specifies flags for the attributes of a method implementation.
override int GetHashCode()
Returns the hash code for this instance.
abstract RuntimeMethodHandle MethodHandle
Gets a handle to the internal metadata representation of a method.
static void KeepAlive(object obj)
References the specified object, which makes it ineligible for garbage collection from the start of t...
Represents a type using an internal metadata token.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
override bool Equals(object obj)
Indicates whether this instance is equal to a specified object.
void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a T:System.Runtime.Serialization.SerializationInfo with the data necessary to deserialize t...
IntPtr Value
Gets the value of this instance.
Cer
Specifies a method's behavior when called within a constrained execution region.
Provides access to the metadata and MSIL for the body of a method.
Provides information about, and means to manipulate, the current environment and platform....
T:System.RuntimeMethodHandle is a handle to the internal metadata representation of a method.
static bool operator !=(RuntimeMethodHandle left, RuntimeMethodHandle right)
Indicates whether two instances of T:System.RuntimeMethodHandle are not equal.
UnmanagedType
Identifies how to marshal parameters or fields to unmanaged code.
A platform-specific type that is used to represent a pointer or a handle.
Provides information about methods and constructors.
The exception thrown when an error occurs during serialization or deserialization.
MethodImplOptions
Defines the details of how a method is implemented.
CharSet
Dictates which character set marshaled strings should use.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
Controls the system garbage collector, a service that automatically reclaims unused memory.
Allows an object to control its own serialization and deserialization.
static readonly IntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
Specifies that the class can be serialized.
bool Equals(RuntimeMethodHandle handle)
Indicates whether this instance is equal to a specified T:System.RuntimeMethodHandle.
Consistency
Specifies a reliability contract.
ModuleHandle ModuleHandle
Gets a handle for the module.
Provides the base class for value types.