반응형
App.xaml
DispatcherUnhandledException="Application_DispatcherUnhandledException"
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TestApp"
DispatcherUnhandledException="Application_DispatcherUnhandledException"
x:Class="TestApp.App"
StartupUri="View/Main/MainWnd.xaml">
<Application.Resources>
</Application.Resources>
</Application>
App.xaml.cs
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
Logger.Error(e.Exception.ToString());
string errorMessage;
errorMessage = e.Exception.Message;
MessageBox.Show("An unhandled error occurred : " + errorMessage);
e.Handled = true;
}
반응형
'[====== Development ======] > C#' 카테고리의 다른 글
Linq를 사용하여 List에서 가장 가까운값 찾기 (0) | 2022.04.13 |
---|---|
[WPF] Passwordbox 의 Focus를 끝으로 지정하는 Extention (2) | 2022.04.12 |
[WPF] Window의 배율과 상관없이 일정한 크기로 App이 실행되도록 하는 방법 (0) | 2022.04.01 |
[C#] Folder 선택 Dialog 기능 (0) | 2022.03.14 |
[C#] Send Struct data to MFC App by SendMessage (0) | 2022.03.11 |