C#は、実行可能ファイルのメソッドは例外をスローします

プログラムのエントリでは、次のコードを追加します。

AppDomain.CurrentDomain.UnhandledException + = 新しい UnhandledExceptionEventHandler(CurrentDomain_UnhandledException)。

後ろのメソッドを追加します。

        プライベート 静的 ボイド CurrentDomain_UnhandledException(オブジェクト送信者、UnhandledExceptionEventArgs E)
        { 
            Console.WriteLineを(e.ExceptionObject.ToString())。
            MessageBox.Show(e.ExceptionObject.ToString())。
        }

 

おすすめ

転載: www.cnblogs.com/LcVong/p/12469278.html