Visual Studio: setting a conditional breakpoint without setting an unconditional first

Sometimes, while I am browsing my program, I want to set a breakpoint with conditions. At the moment, I am doing this by clicking on creating an unconditional breakpoint, then right-clicking to change the condition. This has the disadvantage that I will stop the program on an unwanted iteration. Is there a way to set the condition immediately?

+4
source share
2 answers

I was going to suggest a macro route. I was bored, and I went to him, if this macro starts it, a dialog appears and a condition is set. You may need to participate a bit if you want more bells and whistles.

Sub addBreakpointWithCondition() Dim cond As String = InputBox("Enter the condition") DTE.Debugger.Breakpoints.Add(File:=DTE.ActiveDocument.FullName, Line:=DTE.ActiveDocument.Selection.CurrentLine, Condition:=cond) End Sub 
+3
source

Not through the IDE. You can write a macro to achieve this EnvDTE.Debugger.Breakpoints.Add () method. It allows you to directly specify the Condition property. Not sure if the time you will record is equivalent to repeating pressing F5.

+1
source

Source: https://habr.com/ru/post/1335236/


All Articles