Avatar of Easwaran Paramasivam
Easwaran ParamasivamFlag for India

asked on 

Macro not working in VS.NET 2005 and VS.NET 2008

Dear Experts,

   I've below macro. In VS.NET 2010, I search for some keyword. If I run the macro it will put breakpoints in all the possible lines of result window (Find Result 1 Window). This is not working for VS.NET 2005 and VS.NET 2008. Debugger as well not attaching if I put breakpoint in the macro. Kindly assist to resolve the issue.

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

Public Module BreakPoint

    Sub BreakPointAtString()

        Dim findResultsWindow As Window = DTE.Windows.Item(Constants.vsWindowKindFindResults1)

        Dim selection As TextSelection
        selection = findResultsWindow.Selection
        selection.SelectAll()



        Dim findResultsReader As New StringReader(selection.Text)
        Dim findResult As String = findResultsReader.ReadLine()

        Dim findResultRegex As New Regex("(?<Path>.*?)\((?<LineNumber>\d+)\):")

        While Not findResult Is Nothing
            Dim findResultMatch As Match = findResultRegex.Match(findResult)

            If findResultMatch.Success Then
                Dim path As String = findResultMatch.Groups.Item("Path").Value
                Dim lineNumber As Integer = Integer.Parse(findResultMatch.Groups.Item("LineNumber").Value)

                Try
                    DTE.Debugger.Breakpoints.Add("", path, lineNumber)
                Catch ex As Exception
                    ' breakpoints can't be added everywhere
                End Try
            End If

            findResult = findResultsReader.ReadLine()
        End While

    End Sub



End Module

Open in new window

.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Easwaran Paramasivam
ASKER CERTIFIED SOLUTION
Avatar of CtrlAltDl
CtrlAltDl
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Easwaran Paramasivam

ASKER

Great!!
Avatar of Easwaran Paramasivam

ASKER

@CtrlAltDl - Like putting breakpoints from Search Result is it possible to put breakpoints from Symbol result window? If so, please suggest how to achieve it.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo