Visual Studio Development Bookmark and Share   
 index > Visual Studio Debugger > Is there a way to search/find/scan through those inllisense debugging windows for a particlar data value ?
 

Is there a way to search/find/scan through those inllisense debugging windows for a particlar data value ?

Hello, is  there a way to search/find/scan through those little "+" inllisense debugging windows for a particlar data value ?

Reason is i just spent about a week trying to figure out how to access a field within a dynamcially created TemplateColumn field and found after much trial and error that the data value i was looking for could be accessed through this combination of fields:   "...item.DataItem)"  ie: Datastring z = ((DataRowView)item.DataItem)["myCol2"].ToString(); So i'm wondering if there is a way that i would be able to create a program statement that would basically do the following:
When i arrive at breakpoint, i would execute a procedure that would scan through all of those heap, stack or debugging
assist strututures, ie those windows with the hierarchy of "+" signs and find the actual data value, ie "Jane Doe" and return
with a list of the structure field names that contain the "Jane Doe" value? For example if i ran the scan on my most recent
excercise and searched for "Jane Doe" i would have seen "Jane Doe" contained in the "..item.DataItem.." field.

Thanks for any ideas on maybe how to set up something like this programatically?
BobK
bobk544  Tuesday, October 06, 2009 12:13 PM
You could do this yourself with a macro.

Here's an example:

Imports System

Imports EnvDTE

Imports EnvDTE80

Imports EnvDTE90

Imports System.Diagnostics

 

Public Module Module1

    Sub FindValueInExpression(Optional ByVal expAndValStr As String = "")

        Dim expression As EnvDTE.Expression

 

        Dim params As String() = expAndValStr.Split(New Char() {","c})

 

        expression = DTE.Debugger.GetExpression(params(0), True)

        If expression.IsValidValue Then

            FindValueInExpression(expression, Trim(params(1)))

        End If

 

    End Sub

    Sub FindValueInExpression(ByRef exp As Expression, ByRef valStr As String)

        Dim i As Integer = 1

 

        While i <= exp.DataMembers.Count

 

            If exp.DataMembers.Item(i).Value = valStr Then

                Dim commandWindow As EnvDTE.CommandWindow

                commandWindow = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow).Object

                commandWindow.OutputString("Found it at " & exp.Name & " " & exp.DataMembers.Item(i).Name & vbLf)

            Else

                FindValueInExpression(exp.DataMembers.Item(i), valStr)

            End If

 

            i = i + 1

        End While

 

    End Sub

 

End Module

rchiodo - MSFT  Tuesday, October 13, 2009 6:13 PM
Hello,

I assumed you mean a Debugger Visualizer for a data type when saying "those little '+' inllisense debugging windows for a particlar data value"? Please correct me if I misunderstand you.

That's depends on what kind of data we want to use with the Visualizer. We could define a custom Debugger Visualizer by programming. By default, the debugger visualizers are stored in the directory: C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers (on my machine). We could find a Linq Query Visualizer in the Sample folder.

For more information about the Linq Query Visualizer sample, please refer to:
http://msdn.microsoft.com/en-us/library/bb629285.aspx

Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework!
Roahn Luo  Wednesday, October 07, 2009 7:47 AM
You could do this yourself with a macro.

Here's an example:

Imports System

Imports EnvDTE

Imports EnvDTE80

Imports EnvDTE90

Imports System.Diagnostics

 

Public Module Module1

    Sub FindValueInExpression(Optional ByVal expAndValStr As String = "")

        Dim expression As EnvDTE.Expression

 

        Dim params As String() = expAndValStr.Split(New Char() {","c})

 

        expression = DTE.Debugger.GetExpression(params(0), True)

        If expression.IsValidValue Then

            FindValueInExpression(expression, Trim(params(1)))

        End If

 

    End Sub

    Sub FindValueInExpression(ByRef exp As Expression, ByRef valStr As String)

        Dim i As Integer = 1

 

        While i <= exp.DataMembers.Count

 

            If exp.DataMembers.Item(i).Value = valStr Then

                Dim commandWindow As EnvDTE.CommandWindow

                commandWindow = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow).Object

                commandWindow.OutputString("Found it at " & exp.Name & " " & exp.DataMembers.Item(i).Name & vbLf)

            Else

                FindValueInExpression(exp.DataMembers.Item(i), valStr)

            End If

 

            i = i + 1

        End While

 

    End Sub

 

End Module

rchiodo - MSFT  Tuesday, October 13, 2009 6:13 PM

You can use google to search for other answers

Custom Search

More Threads

• How to debug a control panel application (symbols not loaded)
• weird behaviour when debugging singleton object
• Debugging web services From SQL CLR functions
• C# method works differently when stepping through it's lines with the debugger
• Visual Studio doesn't indicate the line where there is the bug.
• Web App stuck in Debug Mode
• VS Lockup When Viewing .js File
• Debug break freezes entire XP/SP3 OS. anybody has solution?
• Edit and continue managed code remotely
• Debug Remoto Visual Studio 2005