当它被抛出并被捕获时,不要在那个异常处停止调试器 [英] Don't stop debugger at THAT exception when it's thrown and caught

查看:23
本文介绍了当它被抛出并被捕获时,不要在那个异常处停止调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工具/异常中,我设置了在抛出异常时调试器停止的选项.不管是不是被抓到了.

In tools/exceptions, I've set the option that the debugger stops when an exception is thrown. Whether it is caught or not .

如何排除该规则的例外情况?在我的代码中的某个地方有一个捕获的异常,它是程序逻辑的一部分.因此,我显然不希望该异常在每次命中时都停止调试器.

How do I exclude an exception of that rule? Somewhere in my code there is a caught exception that is part of the program logic. So I obviously don't want that exception to stop the debugger each time it is hit.

示例:我想忽略第 344 行的 nullreference 异常(被捕获).我想在所有其他例外情况下停止

Example: I want to ignore the nullreference exception (which is caught) on line 344 . I want to stop at all other exceptions

推荐答案

如果我没记错的话,您可以在包含您不想触发异常的代码的方法上使用 DebuggerStepThrough 属性.我想你可以隔离在方法中触发恼人异常的代码,并用属性装饰它.

If I recall correctly you can use a DebuggerStepThrough attribute on the method that contains the code you don't want exception to fire. I suppose you can isolate the code that fires the annoying exception in a method and decorate it with the attribute.

这篇关于当它被抛出并被捕获时,不要在那个异常处停止调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆