views:

30

answers:

1

This is neat: How do I put a breakpoint at every MessageBox in my application?

But is there a way to do this type of thing for tokens in the Task List (View menu -> Task List) as well? For example, I have code like this:

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

In the above, RETEST is a Task List token; is there a way to set a breakpoint on all lines matching a certain Task List token quickly without having to go to each line where the token was found?

UPDATE

Here is the macro (inspired by http://stackoverflow.com/questions/73063/how-do-i-add-debug-breakpoints-to-lines-displayed-in-a-find-results-window-in-v/249501#249501):

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
A: 

Unfortunately no such precanned functionality exists in Visual Studio. It would likely be possible to do with a Macro.

JaredPar
Thanks! I should have connected the two..found a macro at:http://stackoverflow.com/questions/73063/how-do-i-add-debug-breakpoints-to-lines-displayed-in-a-find-results-window-in-v. Now for some hacking. Will post my results.
Liao