Guest User

Untitled

a guest
May 7th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. [MethodImpl(MethodImplOptions.NoInlining), DebuggerHidden, SecuritySafeCritical, DebuggerStepThrough]
  2. public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
  3. {
  4.     object[] arguments = this.InvokeArgumentsCheck(obj, invokeAttr, binder, parameters, culture);
  5.     StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
  6.     INVOCATION_FLAGS invocationFlags = this.InvocationFlags;
  7.     if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
  8.     {
  9.         RuntimeAssembly executingAssembly = RuntimeAssembly.GetExecutingAssembly(ref lookForMyCaller);
  10.         if ((executingAssembly != null) && !executingAssembly.IsSafeForReflection())
  11.         {
  12.             throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", new object[] { base.FullName }));
  13.         }
  14.     }
  15.     if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
  16.     {
  17.         if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
  18.         {
  19.             CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess);
  20.         }
  21.         if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
  22.         {
  23.             RuntimeMethodHandle.PerformSecurityCheck(obj, this, this.m_declaringType, (uint) this.m_invocationFlags);
  24.         }
  25.     }
  26.     return this.UnsafeInvokeInternal(obj, parameters, arguments);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment