1

我尝试创建一个简单的宏来在执行 RunToCursor 时忽略断点。

但由于某种原因,RunToCursor 调用根本不起作用(“不支持操作”),并且断点状态也没有正确重置。有些被重新激活,但不是全部。有任何想法吗?

Sub RunToLineAndIgnoreBreakpoints()
    Dim bptStates(DTE.Debugger.Breakpoints.Count - 1) As Boolean


    Dim i = 0
    For Each bpt As Breakpoint In DTE.Debugger.Breakpoints
        bptStates(i) = bpt.Enabled
        i += 1
        bpt.Enabled = False
    Next

    Try
        DTE.Debugger.RunToCursor(True)
        '       Catch ex As Exception
    Finally
        i = 0
        For Each bpt As Breakpoint In DTE.Debugger.Breakpoints
            bpt.Enabled = bptStates(i)
            i += 1
        Next
    End Try
End Sub
4

0 回答 0