public void Execute(ActionExecutionContext context) { var callContext = SynchronizationContext.Current; // Wrap the inner result in a SequentialResult s.t. it gets injected by the container but avoid deep nesting var wrapper = (_inner is SequentialResult || _inner is ResultDecoratorBase) ? _inner : new SequentialResult(new SingleResultEnumerator(_inner)); var task = new ResultExecutionTask(wrapper, context); SendOrPostCallback callback = x => { var args = (x as ResultExecutionTask).CompletionEventArgs; if (callContext != null) { _log.Info("Invoking complete on calling context {0}", callContext); callContext.Send(y => Completed(this, y as ResultCompletionEventArgs), args); } else { Completed(this, args); } }; _log.Info("Delegating execution of {0} to worker thread", _inner); ResultSyncContext.Post(callback, task); }