Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable/remove child Breakpoints?

I'm debugging an ASP.NET Website with C# in Visual Studio. When I set a breakpoint (during debug), over time, the created breakpoint will accumulate many child breakpoints. (See here.)
Now, sometimes when I remove a breakpoint by clicking the red glyph, the breakpoint will still be hit the next time the line is executed, because the child breakpoints persisted.

Removing the breakpoint in the breakpoint window will resolve the problem, but it's annoying to find the correct breakpoint(s) when you have many set. Also, the removal of a breakpoint with many children is quite a slow operation.

So to get to the question, can I disable this creation of child breakpoints, or is there a way to quickly remove all children?
Alternative solutions are appreciated!


Please note that this isn't a duplicate of this: Question on how to remove a Visual Studio Breakpoint, because I'm asking how to deal with the child breakpoints. (Although our intended goal is the same.)

like image 244
Protector one Avatar asked Nov 03 '11 10:11

Protector one


People also ask

How do you set Remove enable and disable breakpoints?

In the Breakpoints window, right-click the breakpoint, and then click Delete on the shortcut menu. In the Breakpoints window, select the breakpoint, and then press DELETE.

How do I remove all breakpoints in Chrome?

Check the checkbox next to an entry to disable that breakpoint. Right-click an entry to remove that breakpoint. Right-click anywhere in the Breakpoints pane to deactivate all breakpoints, disable all breakpoints, or remove all breakpoints.

How do you stop breakpoints?

In the Query Editor window, right-click the breakpoint, and then click Disable Breakpoint. In the Breakpoints window, clear the check box to the left of the breakpoint.

How do I remove all breakpoints in Visual Studio?

Visual Studio ask for a confirmation dialog to re-ensure if you really want to remove all the breakpoints. Once you select the “Delete All Breakpoints” option / press Ctrl+Shift+F9 from the debug menu, it will ask for for the confirmation “Do you want to delete all breakpoints?”


1 Answers

The following code can be used as a macro to remove all the child breakpoints.

Sub RemoveChildBreakpoints()
    Dim i As Integer
    Dim len As Integer
    Dim debugger As EnvDTE.Debugger = DTE.Debugger
    Dim children As EnvDTE.Breakpoints
    For Each bp As EnvDTE.Breakpoint In debugger.Breakpoints
        children = bp.Children
        len = children.Count
        For i = len To 1 Step -1
            children.Item(i).Delete()
        Next
    Next
End Sub

It's still insanely slow if you have many breakpoints, so it's best to do run it on a regular basis if you're having a problem with child breakpoints.

like image 194
Protector one Avatar answered Oct 04 '22 16:10

Protector one