Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [MethodImpl(MethodImplOptions.NoInlining), DebuggerHidden, SecuritySafeCritical, DebuggerStepThrough]
- public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
- {
- object[] arguments = this.InvokeArgumentsCheck(obj, invokeAttr, binder, parameters, culture);
- StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
- INVOCATION_FLAGS invocationFlags = this.InvocationFlags;
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
- {
- RuntimeAssembly executingAssembly = RuntimeAssembly.GetExecutingAssembly(ref lookForMyCaller);
- if ((executingAssembly != null) && !executingAssembly.IsSafeForReflection())
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", new object[] { base.FullName }));
- }
- }
- if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
- {
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
- {
- CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess);
- }
- if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
- {
- RuntimeMethodHandle.PerformSecurityCheck(obj, this, this.m_declaringType, (uint) this.m_invocationFlags);
- }
- }
- return this.UnsafeInvokeInternal(obj, parameters, arguments);
- }
Advertisement
Add Comment
Please, Sign In to add comment