如何告诉Visual Studio不要在特定异常上休息? [英] How can I tell Visual Studio to NOT BREAK on a particular exception?

查看:61
本文介绍了如何告诉Visual Studio不要在特定异常上休息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种特殊类型的异常,我希望Visual Studio 不要中断,并显示异常助手"屏幕.本质上,我只想让我的常规异常处理基础结构来处理它.

I have a particular type of exception that I would like Visual Studio to not break on and show the Exception Assistant screen. Essentially I would like it just to let my normal exception handling infrastructure deal with it.

该异常是我编写的System.Exception的继承者,并具有其源代码.任何抛出该异常的地方,我都希望VS不能捕获,也就是说,仅限制一次抛出new BlahException()并没有用.在代码中.这是因为引发了很多异常,并且我不想不得不单独抑制每个实例.

The exception is an inheritor of System.Exception which I wrote and have the source code for. Any where this is thrown I want VS to not catch it, ie it is not useful to just supress a single throw new BlahException(); in code. This is because the exception is thrown a lot, and I don't want to have to supress every single instance individually.

以防万一,我使用的是Visual Studio 2010 Ultimate,Framework 3.5 SP1.

In case it makes a difference I am on Visual Studio 2010 Ultimate, Framework 3.5 SP1.

推荐答案

转到调试"菜单,然后选择例外".选择添加并输入您的例外.这将为您的例外添加一个复选框项.每当该异常被抛出时,如果该复选框处于选中状态,调试器将暂停.确保您的情况下未选中此复选框.

Go to the Debug menu and select Exceptions. Select add and type in your exception. This will add a checkbox item for your exception. Anytime that exception is thrown your debugger will pause if that checkbox is on. Make sure in your case that this checkbox is unchecked.

但是有一件事是,您的异常仍将被抛出并被您实际代码中的任何try/catch块捕获.

One thing though is that your exception will still be thrown and caught in any try/catch blocks you have in your actual code.

这篇关于如何告诉Visual Studio不要在特定异常上休息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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