static void MyHandler(object sender, UnhandledExceptionEventArgs args) { Exception ex1 = (Exception)args.ExceptionObject; SysLog.AddExceptionLog("MainException", ex1); SysLog.AddLog("UnhandledExceptionEventArgs", args); }