Clone() public method

public Clone ( ) : Object
return Object
Ejemplo n.º 1
0
            private ThreadInfo( bool propogateThreadPrincipal, bool propogateCallContext,
                                bool propogateHttpContext, bool propogateCASMarkers )
            {
                if( propogateThreadPrincipal )
                {
                    principal = Thread.CurrentPrincipal;
                }

                if( propogateHttpContext )
                {
                    httpContext = HostContext.Current;
                }

                if( propogateCallContext && (miGetLogicalCallContext != null) )
                {
                    callContext = (LogicalCallContext)miGetLogicalCallContext.Invoke(Thread.CurrentThread, null);
                    callContext = (LogicalCallContext)callContext.Clone();

                    // TODO: consider serialize/deserialize call context to get a MBV snapshot
                    //       instead of leaving it up to the Clone method.
                }

                if( propogateCASMarkers )
                {
                    // TODO: Uncomment the following when Thread.GetCompressedStack is no longer guarded
                    //       by a StrongNameIdentityPermission.
                    //
                    // compressedStack = Thread.CurrentThread.GetCompressedStack();
                }
            }
Ejemplo n.º 2
0
        public ExecutionContext CreateCopy()
        {
            if (!this.isNewCapture)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotCopyUsedContext"));
            }
            ExecutionContext context = new ExecutionContext {
                isNewCapture          = true,
                _syncContext          = (this._syncContext == null) ? null : this._syncContext.CreateCopy(),
                _hostExecutionContext = (this._hostExecutionContext == null) ? null : this._hostExecutionContext.CreateCopy()
            };

            if (this._securityContext != null)
            {
                context._securityContext = this._securityContext.CreateCopy();
                context._securityContext.ExecutionContext = context;
            }
            if (this._logicalCallContext != null)
            {
                System.Runtime.Remoting.Messaging.LogicalCallContext logicalCallContext = this.LogicalCallContext;
                context.LogicalCallContext = (System.Runtime.Remoting.Messaging.LogicalCallContext)logicalCallContext.Clone();
            }
            if (this._illogicalCallContext != null)
            {
                System.Runtime.Remoting.Messaging.IllogicalCallContext illogicalCallContext = this.IllogicalCallContext;
                context.IllogicalCallContext = (System.Runtime.Remoting.Messaging.IllogicalCallContext)illogicalCallContext.Clone();
            }
            return(context);
        }
Ejemplo n.º 3
0
 public LogicalCallContext Clone()
 {
     return((LogicalCallContext)m_ctx.Clone());
 }
Ejemplo n.º 4
0
        internal static ExecutionContext Capture(ref StackCrawlMark stackMark)
        {
            if (IsFlowSuppressed())
            {
                return(null);
            }
            ExecutionContext executionContextNoCreate = System.Threading.Thread.CurrentThread.GetExecutionContextNoCreate();
            ExecutionContext context2 = new ExecutionContext {
                isNewCapture    = true,
                SecurityContext = System.Security.SecurityContext.Capture(executionContextNoCreate, ref stackMark)
            };

            if (context2.SecurityContext != null)
            {
                context2.SecurityContext.ExecutionContext = context2;
            }
            context2._hostExecutionContext = HostExecutionContextManager.CaptureHostExecutionContext();
            if (executionContextNoCreate != null)
            {
                context2._syncContext = (executionContextNoCreate._syncContext == null) ? null : executionContextNoCreate._syncContext.CreateCopy();
                if (executionContextNoCreate._logicalCallContext != null)
                {
                    System.Runtime.Remoting.Messaging.LogicalCallContext logicalCallContext = executionContextNoCreate.LogicalCallContext;
                    context2.LogicalCallContext = (System.Runtime.Remoting.Messaging.LogicalCallContext)logicalCallContext.Clone();
                }
            }
            return(context2);
        }