using System.Threading.Tasks;
var invoker = new GenericEventHandlerInvoker();
invoker.Event += async (s, e) =>
await Task.Run(() => Console.WriteLine("Printing 1 from a task."));
throw new InvalidOperationException("expected 1!");
invoker.Event += async (s, e) =>
await Task.Run(() => Console.WriteLine("Printing 2 from a task."));
throw new InvalidOperationException("expected 2!");
Console.WriteLine("Starting...");
await invoker.InvokeAsync(
Console.WriteLine("We caught the exception!");
Console.WriteLine("Done!");
class GenericEventHandlerInvoker
public event EventHandler<EventArgs> Event;
public async Task InvokeAsync(