private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception error = e.ExceptionObject as Exception; if (error != null) { File.AppendAllText("MyRapid.log", e.ToJson()); //BaseService.SaveLog(error.Message, error.StackTrace, (byte)Sys_Log_Type.Fatal, string.Empty, "UnhandledException"); } }