public AfterInvokeArgs(PipeInvocation invocation, object state, bool isFaulted, Exception exception) { Invocation = invocation; State = state; IsFaulted = isFaulted; Exception = exception; }
public AfterInvokeArgs(PipeInvocation invocation, object?state, bool isFaulted, Exception?exception) { Invocation = invocation; State = state; IsFaulted = isFaulted; Exception = exception; }
private static void DispatchSync(PipeInvocation invocation, MessageDispatch dispatch) { Exception exception = null; try { invocation.Run(); } catch (Exception ex) { exception = ex; } dispatch.SetHandled(invocation.Invoker, exception); }
private void DispatchAsync(PipeInvocation invocation, MessageDispatch dispatch) { var invocationTask = invocation.RunAsync(); invocationTask.ContinueWith(task => dispatch.SetHandled(invocation.Invoker, GetException(task)), TaskContinuationOptions.ExecuteSynchronously); if (invocationTask.Status != TaskStatus.Created) return; if (invocation.Invoker.ShouldCreateStartedTasks) { var exception = new InvalidProgramException(string.Format("{0}.Handle({1}) did not start the returned task", invocation.Invoker.MessageHandlerType.Name, invocation.Invoker.MessageType.Name)); dispatch.SetHandled(invocation.Invoker, exception); return; } var taskScheduler = GetTaskScheduler(invocation.Invoker.DispatchQueueName); invocationTask.Start(taskScheduler); }