How to set breakpoints on strings matching task list tokens in Visual Studio?

This is neat: How to set a breakpoint in every MessageBox in the application?

But is there a way to do this type of thing for tokens in the task list (menu "View" → "Task List")? For example, I have a code like this:

int a=0; //RETEST this code
int b=0; //RETEST this code

In the above example, RETEST is the token of the task list; Is there a way to set a breakpoint on all lines that correspond to a specific token of the task list, without having to go to each line where the token was found?

UPDATE

Here is a macro (inspired by How to Add Debug Breakpoints to the Strings Displayed in the Find Results Window in Visual Studio ):

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Imports System.IO
Imports System.Text.RegularExpressions

Public Module CustomMacros
    Sub SetBreakpointsUsingTaskList()

        Dim TL As TaskList = DTE.ToolWindows.TaskList
        Dim TLItem As TaskItem

        For i = 1 To TL.TaskItems.Count
            TLItem = TL.TaskItems.Item(i)
            Try
                DTE.Debugger.Breakpoints.Add("", TLItem.FileName, TLItem.Line)
            Catch ex As Exception
                ' breakpoints can't be added everywhere
            End Try
        Next
    End Sub
End Module
+3
1

, Visual Studio. , .

0

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


All Articles