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

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

问题描述

简要说明

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

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

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 programmatically.

详细说明:

当引发任何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天全站免登陆