private WorkflowOperationContext(object[] inputs, System.ServiceModel.OperationContext operationContext, string operationName, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.inputs = inputs; this.operationName = operationName; this.OperationContext = operationContext; this.CurrentTransaction = currentTransaction; this.performanceCountersEnabled = performanceCountersEnabled; this.propagateActivity = propagateActivity; this.timeoutHelper = new TimeoutHelper(timeout); this.workflowInstance = workflowInstance; this.thisLock = new object(); this.notification = notification; base.OnCompleting = onCompleting; this.bookmark = behavior.OnResolveBookmark(this, out this.bookmarkScope, out this.bookmarkValue); bool flag = false; try { if (TraceUtility.MessageFlowTracingOnly) { this.e2eActivityId = TraceUtility.GetReceivedActivityId(this.OperationContext); DiagnosticTrace.ActivityId = this.e2eActivityId; } if (this.workflowInstance.BufferedReceiveManager != null) { ReceiveContext.TryGet(this.OperationContext.IncomingMessageProperties, out this.receiveContext); this.OperationContext.IncomingMessageProperties.Remove(ReceiveContext.Name); } flag = this.ProcessRequest(); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.OnCompleting(this, exception); throw; } if (flag) { base.Complete(true); } }
WorkflowOperationContext(object[] inputs, OperationContext operationContext, string operationName, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, ServiceEndpoint endpoint, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.inputs = inputs; this.operationName = operationName; this.OperationContext = operationContext; this.ServiceEndpoint = endpoint; this.CurrentTransaction = currentTransaction; this.performanceCountersEnabled = performanceCountersEnabled; this.propagateActivity = propagateActivity; this.timeoutHelper = new TimeoutHelper(timeout); this.workflowInstance = workflowInstance; this.thisLock = new object(); this.notification = notification; this.OnCompleting = onCompleting; // Resolve bookmark Fx.Assert(behavior != null, "behavior must not be null!"); this.bookmark = behavior.OnResolveBookmark(this, out this.bookmarkScope, out this.bookmarkValue); Fx.Assert(this.bookmark != null, "bookmark must not be null!"); bool completeSelf = false; try { // set activity ID on the executing thread ( if (TraceUtility.MessageFlowTracingOnly) { this.e2eActivityId = TraceUtility.GetReceivedActivityId(this.OperationContext); DiagnosticTraceBase.ActivityId = this.e2eActivityId; } if (Fx.Trace.IsEtwProviderEnabled) { this.eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(this.OperationContext.IncomingMessage); } // Take ownership of the ReceiveContext when buffering is enabled by removing the property if (this.workflowInstance.BufferedReceiveManager != null) { if (!ReceiveContext.TryGet(this.OperationContext.IncomingMessageProperties, out this.receiveContext)) { Fx.Assert("ReceiveContext expected when BufferedReceives are enabled"); } this.OperationContext.IncomingMessageProperties.Remove(ReceiveContext.Name); } completeSelf = ProcessRequest(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } // Failing synchronously is one case where AsyncResult won't handle calling OnCompleting OnCompleting(this, e); throw; } if (completeSelf) { base.Complete(true); } }