Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created May 12, 2014 06:35
Show Gist options
  • Save RhysC/79b9ba632dc878ddae7b to your computer and use it in GitHub Desktop.
Save RhysC/79b9ba632dc878ddae7b to your computer and use it in GitHub Desktop.
Events that you should be using to get UnhandledExceptions
// .NET/CLR app domains
// You - always want to be logging these errors!
AppDomain.CurrentDomain.UnhandledException += (s,e) => {};
// Framework specific handlers
System.Windows.Application.Current.DispatcherUnhandledException += (s,e) => {}; // WPF
System.Windows.Forms.Application.ThreadException += (s,e) => {}; // Windows Forms
System.Threading.Tasks.TaskScheduler.UnobservedTaskException += (s,e) => {}; // TPL - not really very imporant
// ASP.NET (i'm guessing you hook into this in your Global.asx?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment