Solved

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

Posted on 2014-11-13
3
98 Views
Last Modified: 2014-11-18
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

0
Comment
Question by:Easwaran Paramasivam
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
CtrlAltDl earned 500 total points
ID: 40443337
I believe the problem is the older VS don't recognize the newer namespaces (EnvDTE100, EnvDTE90).

Both VS2008 and VS2005 should be able to import EnvDTE and EnvDTE80, but not 100, 90, or 90a.

http://msdn.microsoft.com/en-us/library/yf86a8ts%28v=vs.80%29.aspx
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 40446642
Great!!
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 40449254
@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.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now