namespace Proto { using Proto.Events; using System; using System.Runtime.ExceptionServices; public static class Program { public static void Main(string[] args) { ShowExceptions(); for (int i = 0; i < 3; i++) { try { switch (i) { case 0: throw new InvalidOperationException(); case 1: throw new ObjectDisposedException(""); case 2: throw new ArgumentOutOfRangeException(); } } catch { } } Console.ReadKey(); } private static async void ShowExceptions() { var eventAwaiter = new EventAwaiter(); AppDomain.CurrentDomain.FirstChanceException += eventAwaiter.EventRaised; while (true) { Console.WriteLine("AppDomain exception {0}", (await eventAwaiter).Exception.GetType()); } } } }