public ExecutionContext CreateCopy() { if (!isNewCapture) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotCopyUsedContext")); } ExecutionContext ec = new ExecutionContext(); ec.isNewCapture = true; #if FEATURE_SYNCHRONIZATIONCONTEXT ec._syncContext = _syncContext == null ? null : _syncContext.CreateCopy(); #endif // #if FEATURE_SYNCHRONIZATIONCONTEXT #if FEATURE_CAS_POLICY // capture the host execution context ec._hostExecutionContext = _hostExecutionContext == null ? null : _hostExecutionContext.CreateCopy(); #endif // FEATURE_CAS_POLICY #if FEATURE_IMPERSONATION || FEATURE_COMPRESSEDSTACK if (_securityContext != null) { ec._securityContext = _securityContext.CreateCopy(); ec._securityContext.ExecutionContext = ec; } #endif // #if FEATURE_IMPERSONATION || FEATURE_COMPRESSEDSTACK if (this._logicalCallContext != null) { ec.LogicalCallContext = (LogicalCallContext)this.LogicalCallContext.Clone(); } Contract.Assert(this._illogicalCallContext == null); return(ec); }
public ExecutionContext CreateCopy() { if (!isNewCapture) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotCopyUsedContext")); } ExecutionContext ec = new ExecutionContext(); ec.isNewCapture = true; ec._syncContext = _syncContext == null ? null : _syncContext.CreateCopy(); // capture the host execution context ec._hostExecutionContext = _hostExecutionContext == null ? null : _hostExecutionContext.CreateCopy(); if (_securityContext != null) { ec._securityContext = _securityContext.CreateCopy(); ec._securityContext.ExecutionContext = ec; } if (this._logicalCallContext != null) { LogicalCallContext lc = (LogicalCallContext)this.LogicalCallContext; ec.LogicalCallContext = (LogicalCallContext)lc.Clone(); } if (this._illogicalCallContext != null) { IllogicalCallContext ilcc = (IllogicalCallContext)this.IllogicalCallContext; ec.IllogicalCallContext = (IllogicalCallContext)ilcc.Clone(); } return(ec); }
private static HostExecutionContext CreateCopyHelper(HostExecutionContext hostExecutionContext) { return (hostExecutionContext != null) ? hostExecutionContext.CreateCopy() : null; }
private static HostExecutionContext CreateCopyHelper(HostExecutionContext hostExecutionContext) { // creating a copy of a null context should just itself return null return (hostExecutionContext != null) ? hostExecutionContext.CreateCopy() : null; }