SW개발/c#
[WPF] 모든 에러 발생시 이벤트 발생시키기
YellowThroat
2023. 2. 14. 14:08
[App.xaml.cs]
public partial class App : Application
{
public App()
{
AppDomain.CurrentDomain.FirstChanceException += FirstChanceException;
}
private void FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message);
}
}
무슨 에러가 됐든지간에 에러가 발생하면 해당 코드로 먼저 들어온다.