WPF未知异常捕获(全局)

 public partial class App : Application
    {

        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException +=
             new UnhandledExceptionEventHandler(UnhandledExceptionEventHandler);
        }

        private void UnhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e)
        {
            throw new NotImplementedException();
        }
    }

在文件的启动类中添加如上代码;在UnhandledExceptionEventHandler方法中进行异常的处理

原文地址:https://www.cnblogs.com/weiweiboqi/p/7977747.html