Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching for text in an Object watch window in visual studio

Tags:

I am using visual studio 2010. I have set a breakpoint and added a watch on a complex object with very deep hierarchy. I was wondering if there was any quick way to search this object tree for a particular string I want. Either as a property/value/method etc. In other words, I just want to say "Does this object have anything like "Foo" in it. I don't care what it is, just tell me if it knows about "Foo". Give me all instances of "Foo"."

For example, if I have an object containing 3 Dictionaries and 4 XML elements, when I break and add watch on the object and search for "Foo", I want to find out that list 2 has a string with "Foo", List 3 has an Object "Bar" which has property "Foo" and XMLElement 1 has a child "Foo"

Is there any powerpack plugin, commercial plugin or some other extension of visual studio that would let me do this?

To give you some context. I am evaluating various PDF parsing components to parse various PDFs. I am trying to extract certain custom tags, pdf content and various other artifacts etc. While doing this, once the pdf is read and parsed, it would be nice to search the object and say something like does this know anything about the text "My Signature"... hmm.. nope. Ok. Lets call this "ConvertToHTML" method to get object B. Does object B know anything about "My Signature" etc.

Any help would be greatly appreciated.

like image 916
Chaitanya Avatar asked Oct 13 '10 07:10

Chaitanya


People also ask

How do I search for text in Visual Studio?

In Visual Studio 2022 and later, you can set Visual Studio to always keep results. Go to Tools > Options > General > Find and Replace, and select the checkbox for Keep search results by default.

How do I search for a word in Visual Studio code?

Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location.


1 Answers

Visual Studio 2019

This is now natively supported in Visual Studio 2019

Searching for objects and properties in the Watch, Autos, and Locals Window by Leslie Richardson

VS Code Search

OZ Code

There is also a commercial Visual Studio Extension called OzCode which has lots of debugging experience enhancements including search:

OZ Code Search

like image 116
KyleMit Avatar answered Sep 18 '22 23:09

KyleMit