AppDomain.CurrentDomain.UnhandledException += (sender, args) => { Console.WriteLine("Test"); }; Code: C#