https://qiita.com/smi/items/28d9148e5fa97ed30658
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnThreadException);
検索するとUncaughtExceptionHandlerを使えというのがいっぱい引っかかったがうまく行かず、上記の方法でうまくいった。
https://qiita.com/smi/items/28d9148e5fa97ed30658
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnThreadException);
検索するとUncaughtExceptionHandlerを使えというのがいっぱい引っかかったがうまく行かず、上記の方法でうまくいった。