void RaiseForEndpoint(string errorMessage, Exception exception) { Task.Run(() => { var context = new CriticalErrorContext(endpoint.Stop, errorMessage, exception); return criticalErrorAction(context); }); }