知ってると、ちょっと便利かもしれないTips。メモメモ。 この方法は、.NET 4.0から可能です。 .NET 4.0より、AppDomainクラスに以下のイベントが追加されました。 public event EventHandler<FirstChanceExceptionEventArgs> FirstChanceException このイベントは、アプリケーションドメイン内で例外が発生した際に最初に通知されるイベントです。 通知されるタイミングは、コード上のcatchブロックよりも先となります。まさにファーストチャンスの名前通りです。 このイベントは、通知のみのイベントとなっており、イベントをハンドルしたからといって例外の伝播が止まるわけでは ありません。このイベントで処理した後でも通常通り例外はコード上で発生します。また、このイベントは アプリケーションドメイン毎に設定可能です。