正在为异常类型停止 "not handled in user code" 对话框

Stopping "not handled in user code" dialog for exception type

在 visual studio 中,我得到一个对话框,上面写着

"An exception of type XXX occurred in YYY.dll but was not handled in user code"

并暂停我的代码。 VS2013 中是否有一种方法可以仅针对这种异常类型(这是针对自定义异常)抑制这种情况?

是,处理异常。

或者:

  • 解决问题(如 ArgumentNullExceptionIndexOutOfRangeException 的情况);
  • 或者如果这是您可以预料到的:使用 try...catch 块(例如因特网中断导致异常)。

如果要在 handled 异常时禁用消息,您可以在 Debug > Exceptions 中设置 when if Visual Studio breaks on a specific exception 对话框。然后针对您的特定异常取消选中 Thrown