在项目 App.xaml 文件下  => Application 节点=> 添加  DispatcherUnhandledException="Application_DispatcherUnhandledException" 属性

 

App.xaml.cs下添加方法

void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
var comException = e.Exception as System.Runtime.InteropServices.COMException;
if (comException != null && comException.ErrorCode == -2147221040)
e.Handled = true;
}

 

本来只是想自己做下笔记,所以写的不是特别清楚。看阅读量比较大特意重新编辑,希望能帮到大家。

 

 

 

 

 .

 

相关文章:

  • 2021-07-19
  • 2021-11-02
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-02-13
  • 2021-10-09
相关资源
相似解决方案