Solved

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

Posted on 2014-11-13
3
96 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
Comment Utility
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
Comment Utility
Great!!
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
Comment Utility
@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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

9 Experts available now in Live!

Get 1:1 Help Now