How can I tell Visual Studio to NOT BREAK on a particular exception?

a 夏天 提交于 2021-02-04 22:14:24

问题


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.

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.

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/2906232/how-can-i-tell-visual-studio-to-not-break-on-a-particular-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!