@@ -37,26 +37,26 @@ public App()
3737 AppDomain . CurrentDomain . UnhandledException += ( sender , args ) =>
3838 {
3939 var exception = args . ExceptionObject as Exception ;
40- LogError ( "Unhandled Exception" , exception ) ;
40+ LogError ( "Unhandled Exception" , sender , exception ) ;
4141 } ;
4242 TaskScheduler . UnobservedTaskException += ( sender , args ) =>
4343 {
44- LogError ( "Unobserved Task Exception" , args . Exception ) ;
44+ LogError ( "Unobserved Task Exception" , sender , args . Exception ) ;
4545 args . SetObserved ( ) ;
4646 } ;
4747
4848 Application . Current . UnhandledException += ( sender , args ) =>
4949 {
50- LogError ( "UI Thread Exception" , args . Exception ) ;
50+ LogError ( "UI Thread Exception" , sender , args . Exception ) ;
5151 args . Handled = true ;
5252 } ;
53- LogError ( "UI Thread Exception" , new Exception ( ) ) ;
53+ LogError ( "UI Thread Exception" , new object { } , new Exception ( ) ) ;
5454 }
5555
56- private static void LogError ( string title , Exception exception )
56+ public static void LogError ( string title , object sender , Exception exception )
5757 {
5858 var logFilePath = Path . Combine ( Environment . CurrentDirectory , "error.log" ) ;
59- var logMessage = $ "{ DateTime . Now } : { title } \n { exception } \n \n ";
59+ var logMessage = $ "{ DateTime . Now } : { title } \n { sender } \n { exception } \n \n ";
6060
6161 File . AppendAllText ( logFilePath , logMessage ) ;
6262 }
0 commit comments