切换“抛出异常时中断”。 使用宏或键盘快捷键
编辑:Visual Studio 2015 的新异常窗口比 我不再关心使用键盘的旧对话框 它的快捷方式。
是否有宏或键盘快捷键可以在不使用 GUI 的情况下切换“抛出异常时中断”?
使用 ctrl+alt+e 打开对话框并选中“公共语言运行时异常”“抛出”框,然后单击“确定”非常简单,但这是我经常做的事情。 我宁愿有一个键盘快捷键。
这个问题是重复的 任何有视觉效果用于在已处理/未处理的异常上切换中断的 Studio 快捷方式/宏?
但是,发布者接受了一个实际上不起作用的答案,我真的很想要一个确实有效的答案。
重复问题中的答案是不可接受的,因为它仅切换一个特定的异常,而不是整个 CLR 组。
“那就写一个循环吧。” 你说。 但没那么快! 已经有人尝试过 而且速度慢得毫无用处。 (是的,我已经验证它在我的系统上也很慢。)
因此,挑战是使用宏在不到 1 或 2 秒的时间内切换整个 CLR 异常类别。 这个问题是重复的 任何有视觉效果用于在已处理/未处理的异常上切换中断的 Studio 快捷方式/宏?
Edit: Visual Studio 2015's new exception window is so much faster than
the old dialog that I no longer care as much about using a keyboard
shortcut for it.
Is there a macro or keyboard shortcut that will toggle "break when an exception is thrown" without using the GUI?
Opening the dialog with ctrl+alt+e and checking the "Common Language Runtime Exceptions" "Thrown" box then clicking OK is simple enough, but this is something I do a lot. I would rather have a keyboard shortcut for this.
This question is a duplicate of
Any have a Visual Studio shortcut/macro for toggling break on handled/unhandled exceptions?
However, the poster accepted an answer that doesn't really work, and I would really like an answer that does work.
The answer in the duplicate question is not acceptable because it toggles only one specific exception, not the entire CLR group.
"Well write a loop then." you say. But not so fast! Someone tried that already and it was uselessly slow. (Yes I've verified that its slow on my system as well.)
So the challenge is to use a macro to toggle the entire CLR Exceptions category in less than 1 or 2 seconds.
This question is a duplicate of
Any have a Visual Studio shortcut/macro for toggling break on handled/unhandled exceptions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
与其他答案非常相似,但该组有一个特殊的 ExceptionSetting。
Very similar to the other answer, but there is a special ExceptionSetting for the group.
我创建了一个免费的 Visual Studio 扩展,可以可靠地做到这一点: Exception Breaker< /a>.
它使用未记录的
IDebugSession2.SetException
调用,速度非常快:所有异常都在 20 到 60 毫秒内设置/取消设置。I have created a free Visual Studio extension that can do that reliably: Exception Breaker.
It uses undocumented
IDebugSession2.SetException
call that is very fast: all exceptions are set/unset in 20 to 60 milliseconds.这是 Bryce Kahle 的非常有用的宏,盲目更新为在 VS2010 中运行:
Here's Bryce Kahle's very useful macro blindly updated to run in VS2010:
嗯,我写了一个基于 VS2008 C# 的插件,可以切换 386 个异常,每个状态切换大约需要 1 秒。 我假设这是由于 COM 互操作造成的。
这是基于您的链接之一中的 VB/宏代码。 我找不到更简单的 C++ 方法(但不排除它)。
下一个级别是制作一个具有键盘绑定的插件,然后打开例外 UI,然后为您“单击”正确的复选框。
祝你好运。
Well, I wrote a VS2008 C# based plug-in that toggles the 386 exceptions, and it takes about 1 second per state toggle. I'm assuming that's due to COM inter-op.
This was based on the VB/macro code in the one of your links. I could not find an easier C++ method (but not ruling it out).
The next level would be to make a plug-in that has a keyboard binding, that then opens the Exceptions UI and then "clicks" the correct tick box for you.
Good luck.
您可以使用 AutoHotKey 之类的工具来创建录制的脚本(鼠标单击或按键),然后对其进行分配按下时会播放的热键...
You could use a tool like AutoHotKey to create a recorded script (mouse clicks or key presses) and then assign it a hotkey that will play it back when pressed...
只是提供一些我在这方面找到的信息(此处),就像我一样在我徒劳的尝试中搜索网络以提供帮助...
其他人提出了同样的问题,MS 支持的 Gary Chang 对此做出了回应,以下是引用的回应:
需要注意的是,此帖子是 2005 年 12 月发布的,因此此响应可能不再准确;请务必注意。 不管怎样,我想我会把它扔在那里。
Just offering some info I found on this (here) as I was scouring the net in my futile attempt to help...
Someone else posed this same question and it was responded to by Gary Chang from MS Support, here's the quoted response:
It's important to note that this posting is from December of 2005 so this response may no longer be accurate; either way, thought I'd throw it out there.
首先我初始化了一个计时器,然后调用命令 Exception.Debug。
当模态对话框打开时,计时器开始计时。
如果您使用 Win 7 并停用 UAC SendKeys 和 ALT-Key 将失败...我不知道为什么。
我玩了一点...试试这个(VS2010 EN):
First i initalized a timer an then i call the command Exception.Debug.
The timer hit, when the modal dialog is openend.
If you use Win 7 with deactivated UAC SendKeys with ALT-Key will fail...i don't know why.
i played a little bit...try this (VS2010 EN):
为组设置特殊 ExceptionSetting 的建议确实会切换顶级复选框的状态。 但是,它似乎并没有切换树中其下方的各个异常,而且,当抛出此类异常时,我的进程不会停止,就像我手动检查顶级复选框一样。 您看到不同的行为吗?
The suggestion of setting the special ExceptionSetting for the group does indeed toggle the state of the top-level checkbox. However, it doesn't seem to toggle the individual Exceptions below it in the tree, and moreover, my process does not stop when such exceptions are thrown as it does if I manually check the top-level checkbox. Do you see different behavior?
我的宏在运行时忽略当前的 CLR 异常。 当调试时弹出异常时,它的工作原理就像一个“禁用捕获此异常类型”的按钮。
My macro to ignore current CLR exception in runtime. It works like a button 'disable catching this exception type' when an exception pops at debug-time.
CTRL + ALT + E
ALT+T
输入
对我有用
CTRL + ALT + E
ALT + T
Enter
works for me