/// <summary> /// Initializes handlers for unhandled exception. /// </summary> /// <param name="mode">Defines where a Windows Forms application should send unhandled exceptions.</param> /// <param name="threadScope">True to set the thread exception mode.</param> public static void Attach(System.Windows.Forms.UnhandledExceptionMode mode, bool threadScope) { lock (SyncRoot) { System.Windows.Forms.Application.SetUnhandledExceptionMode(mode, threadScope); System.Windows.Forms.Application.ThreadException += Application_ThreadException; System.AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; } }
/// <summary> /// Initializes handlers for unhandled exception. /// </summary> /// <param name="mode">Defines where a Windows Forms application should send unhandled exceptions.</param> public static void Attach(System.Windows.Forms.UnhandledExceptionMode mode) { lock (SyncRoot) { Attach(mode, true); } }