【发布时间】:2020-06-16 18:11:49
【问题描述】:
我在整个应用程序中都有很多 throw new NotImplementedExceptions()。现在我想让它们静音并改为显示自定义消息对话框。
为了捕捉它们,我正在使用:
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
if(eventArgs.Exception is NotImplementedException) {
return;
}
}
但问题是仍然抛出异常。
当我在这段代码中捕获到这种类型的异常时,如何使抛出静音?
【问题讨论】:
-
您可以在异常窗口调试期间禁用特定异常
-
你不能只使用一个try catch,它捕获NotImplemented Exceptions,然后忽略它们吗? :) 我的意思是它脏得要命,但我假设你最终会摆脱它们?
-
这个想法不是在调试期间使异常静音。在将发布版本提供给客户后,将所有这些(暂时)静音。
-
关于 try/catch,我有很多 NotImplementedExceptions。我只是想检查是否有更简单、更清洁的方法来做到这一点。