private Transaction GetCurrentTransactionCore(ActivityContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull(nameof(context)); } context.ThrowIfDisposed(); //If the transaction is a runtime transaction (i.e. an Invoke with ambient transaction case), then //we do not require that it be registered since the handle created for the root transaction is never registered. if (this.rootTransaction == null) { this.ThrowIfNotRegistered(SR.RuntimeTransactionHandleNotRegisteredAsExecutionProperty("GetCurrentTransaction")); } if (!this.isHandleInitialized) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnInitializedRuntimeTransactionHandle)); } if (this.SuppressTransaction) { return(null); } return(this.executor.CurrentTransaction); }
private void ValidateAccessor(ActivityContext context) { // We need to call ThrowIfDisposed explicitly since // context.Activity does not check isDisposed context.ThrowIfDisposed(); if (!object.ReferenceEquals(context.Activity, this.validAccessor)) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InlinedLocationReferenceOnlyAccessibleByOwner(context.Activity, this.validAccessor))); } }