我可以在VisualStudio中点击跳线吗? [英] Can I have a hit-point in VisualStudio that skips lines?
问题描述
我经常遇到这样的情况,我想在调试时禁用一些代码,而不用改变代码。
I often run into the situation where I want to disable some code while debugging without actually changing the code.
我最终做的是有一个断点(通常为条件),然后当中断点触发时,我执行设置下一个语句。当代码达到很多次时,这可能非常劳动密集,因此我创建了一个宏:
What I end up doing is having a break-point (usually conditional) and then when the break-point fires I perform a Set Next Statement. This can be very labor intensive when the code is reached many times so I created a macro:
Sub Skip3Lines()
DTE.ActiveDocument.Selection.LineDown(False, 3)
DTE.Debugger.SetNextStatement()
End Sub
然后,我将我的断点改为点击(右键单击 - >当Hit ...
)并且告诉它执行此宏。
I then changed my break-point to be a hit-point (right-click -> When Hit...
) and told it to execute this macro.
Visual studio非常高兴吐出以下对话框:
Visual studio was all too happy to spit out the following dialog box:
---------------------------
错误
------------------- --------
一个宏,称为调试器动作,在响应某个事件或由于断点而被运行时不允许被击中。
---------------------------
确定
--------- ------------------
有没有人知道如何解决这个问题?
Does anyone know how to get around this?
推荐答案
DTE.ExecuteCommand(Debug.SetNextStatement)
DTE.ExecuteCommand("Debug.SetNextStatement")
这篇关于我可以在VisualStudio中点击跳线吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!