标签:测试 protect dex run thread and err led tar
跟着《WPF专业编程开发指南》这书打的代码的,自己在正式项目中测试通过,可以抓取到全局的异常,用的log4net来记录日志
核心代码:
写在App.xaml.cs中
/// <summary> /// App.xaml 的交互逻辑 /// </summary> public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); } void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { Common.Log.Error($"抓到未知异常:",e.Exception); } }
标签:测试 protect dex run thread and err led tar
原文地址:https://www.cnblogs.com/niunan/p/10840428.html