SetExecutionContextHelper() private method

private SetExecutionContextHelper ( ExecutionContext ec ) : void
ec ExecutionContext
return void
        private void Start(ref StackCrawlMark stackMark)
        {
            this.StartupSetApartmentStateInternal();
            if (this.m_Delegate != null)
            {
                ThreadHelper target = (ThreadHelper)this.m_Delegate.Target;
                System.Threading.ExecutionContext ec = System.Threading.ExecutionContext.Capture(ref stackMark, System.Threading.ExecutionContext.CaptureOptions.IgnoreSyncCtx);
                target.SetExecutionContextHelper(ec);
            }
            IPrincipal principal = CallContext.Principal;

            this.StartInternal(principal, ref stackMark);
        }
Example #2
0
        public void Start()
        {
            this.StartupSetApartmentStateInternal();
            if (this.m_Delegate != null)
            {
                ThreadHelper target = (ThreadHelper)this.m_Delegate.Target;
                System.Threading.ExecutionContext ec = System.Threading.ExecutionContext.Capture();
                System.Threading.ExecutionContext.ClearSyncContext(ec);
                target.SetExecutionContextHelper(ec);
            }
            IPrincipal     principal       = CallContext.Principal;
            StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;

            this.StartInternal(principal, ref lookForMyCaller);
        }
Example #3
0
        public new void Start()
        {
#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
            // Eagerly initialize the COM Apartment state of the thread if we're allowed to.
            StartupSetApartmentStateInternal();
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT

            // Attach current thread's security principal object to the new
            // thread. Be careful not to bind the current thread to a principal
            // if it's not already bound.
            if (m_Delegate != null)
            {
                // If we reach here with a null delegate, something is broken. But we'll let the StartInternal method take care of
                // reporting an error. Just make sure we don't try to dereference a null delegate.
                ThreadHelper     t  = (ThreadHelper)(m_Delegate.Target);
                ExecutionContext ec = ExecutionContext.Capture();
                t.SetExecutionContextHelper(ec);
            }

            StartInternal();
        }