我可以调整视觉工作室“抛出异常时中断”选项程序化? [英] Can I adjust the visual studio "Break when an exception is thrown" options programatically?

查看:112
本文介绍了我可以调整视觉工作室“抛出异常时中断”选项程序化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简要说明

在Visual Studio 2008中,调试菜单有例外... 选项。

当点击这个时,它会弹出抛出异常时的中断对话框,其中我勾选下一个框到通用语言运行时异常。

In Visual Studio 2008, the Debug menu has an Exceptions... option.
When clicking this, it brings up the "Break when an exception is thrown" dialog, wherein I tick the box next to "Common Language Runtime Exceptions".

我想能够以编程方式勾选/取消这个框。

I want to be able to tick / untick this box programatically.

详细说明:

当引发任何CLR异常时(不是被捕获并重新抛出),这将导致调试器中断,所以这是很好的故障排除。

This causes the debugger to break when any CLR exception is thrown (not when it's caught and re-thrown), so this is great for troubleshooting.

问题是,它捕获所有的CLR异常,.NET框架恰好在内部抛出并捕获一些异常,也被捕获。这导致调试器打破了一些我真正不关心的异常,因为它们是框架内部的,而不是一个问题。

WCF特别是不好这个,就像运气一样,我的应用程序在这个地方使用了WCF。

The problem is, it catches all CLR exceptions, and the .NET framework happens to throw and catch a bunch of exceptions internally, which also get caught. This causes the debugger to break on a bunch of exceptions which I really don't care about as they are internal to the framework and not a problem.
WCF is particularly bad at this, and as fortune has it, my app uses WCF all over the place.

我想做的是复选框被关闭,一旦我的应用程序已经启动(并且已经过WCF连接阶段和所有内部异常),然后启用它,以便从现在开始中的所有异常中断。

What I'd like to do, is have the checkbox turned off, and once my app has started up (and got past the WCF connection phase and all the internal exceptions), then have it turned on, to break on all exceptions from now on.


  • 我知道我不必在所有clr异常上抓住一切,但是可能的异常列表大概是2英里长,它永远是滚动的并选择你想要的(然后如果我想念一些)

推荐答案

没有直接解决您的问题,但是有一个方便的和弦ctrl-D + E会弹出调试异常对话框。 Ctrl + Alt + E会做同样的事情。

This doesn't address your question directly, but there's a handy chord ctrl-D + E that brings up the debugging exceptions dialog. Ctrl+Alt+E will do the same thing.

这篇关于我可以调整视觉工作室“抛出异常时中断”选项程序化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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