Ejemplo n.º 1
0
        protected internal virtual Task RunAsync()
        {
            var runTask = _invoker.InvokeMessageHandlerAsync(this);

            runTask.ContinueWith(task => AfterInvoke(_pipeStates, task.IsFaulted, task.Exception), TaskContinuationOptions.ExecuteSynchronously);

            return(runTask);
        }
Ejemplo n.º 2
0
        protected internal virtual Task RunAsync()
        {
            var pipeStates = BeforeInvoke();

            var runTask = _invoker.InvokeMessageHandlerAsync(this);

            if (runTask.Status == TaskStatus.Created)
            {
                var exception = new InvalidProgramException($"{Invoker.MessageHandlerType.Name}.Handle({Invoker.MessageType.Name}) did not start the returned task");
                runTask = Task.FromException(exception);
            }

            runTask.ContinueWith(task => AfterInvoke(pipeStates, task.IsFaulted, task.Exception), TaskContinuationOptions.ExecuteSynchronously);

            return(runTask);
        }
Ejemplo n.º 3
0
        protected internal virtual Task RunAsync()
        {
            object[] pipeStates;

            try
            {
                pipeStates = BeforeInvoke();
            }
            catch (Exception ex)
            {
                return(TaskHelper.FromError(ex));
            }

            var runTask = _invoker.InvokeMessageHandlerAsync(this);

            runTask.ContinueWith(task => AfterInvoke(pipeStates, task.IsFaulted, task.Exception), TaskContinuationOptions.ExecuteSynchronously);

            return(runTask);
        }