Visual Studio find doesn't find all possibilities
Asked Answered
M

14

9

Recently, I've begun to notice that Visual Studio 2008 isn't finding all of the instances of a text I search for when I'm searching Entire Solution. It will start to search through the files to find a term, but then at some point, it stops searching other files, and starts alternating between only two files. This is very irritating, because I can't always find what I'm looking for. In fact, to make matters worse, sometimes search simply doesn't find a term that I know exists, so I'll close the search form, switch documents, run the search again, and the term will be found.

Note that in all the situations above, I am searching the Entire Solution.

Does anybody have any experience with this? If so, how did you fix it?

Morrow answered 28/1, 2009 at 20:53 Comment(3)
Something that worked for me was to do a Replace All with identical find and replace values. For some reason it found more (all) places than a simple Find All. :/Nitrogenize
D'oh! Somehow, I had put something weird in File types. I didn't look at that because I don't use it much.Germaun
Had also a similar thing with "Find All". If I search with scope "All open documents" it finds all occurrences, but with scope "Project" or "Solution" it misses the one directly in the current document. But the current document is a project file like 'UserControl.xaml.cs' that is part of this project since a long time. Strange. And also, a full replacement run can sometimes restart in the middle of the series. Something wrong there too. But not for this question.Ammamaria
H
4

That is indeed very annoying. This happened to me using VS2003, but I upgraded to VS2005 shortly after so I never tried fixing it. I did a search and here are some possibilities to get you started:

  • Run devenv /resetsettings
  • Window menu-->Select Reset Window Layout (not sure why this would help?)
  • Repair VS2008, if that fails try reinstalling.
Hillel answered 28/1, 2009 at 21:45 Comment(5)
Can't argue with reinstalling.Morrow
Did any of the other suggestions work or did you have to resort to reinstalling?Hillel
Amazingly, Reset Window Layout does work (VS 2008 Express). But WHY?!Haustellum
Because the problem is likely the window ordering. From my observation what it looks like it is reording the windows into a circular fashion while searching. i.e. Window x thinks it's after Window y but Window y thinks it's after Window x. That's my problem. It keeps finding the next one in the window before and therefore it will endlessly find matches.Equation
That window ordering problem also appears to be historical or for new windows while it's searching.Equation
T
5

Yes. "Find Next" is often broken if lots of documents (tabs) are open and you're searching in Current Project or Entire Solution.

Work-around: use "Find All" (Ctrl+Shift+F), that one is reliable across multiple files.

Troublous answered 14/9, 2011 at 14:4 Comment(2)
Thanks! In the last couple of years I all but quit using the simple "Find Next" and have started using Find All instead.Morrow
for me, the Find All does find Nothing in Entire Solution, but finds in the current project.... ??((((Jive
H
4

That is indeed very annoying. This happened to me using VS2003, but I upgraded to VS2005 shortly after so I never tried fixing it. I did a search and here are some possibilities to get you started:

  • Run devenv /resetsettings
  • Window menu-->Select Reset Window Layout (not sure why this would help?)
  • Repair VS2008, if that fails try reinstalling.
Hillel answered 28/1, 2009 at 21:45 Comment(5)
Can't argue with reinstalling.Morrow
Did any of the other suggestions work or did you have to resort to reinstalling?Hillel
Amazingly, Reset Window Layout does work (VS 2008 Express). But WHY?!Haustellum
Because the problem is likely the window ordering. From my observation what it looks like it is reording the windows into a circular fashion while searching. i.e. Window x thinks it's after Window y but Window y thinks it's after Window x. That's my problem. It keeps finding the next one in the window before and therefore it will endlessly find matches.Equation
That window ordering problem also appears to be historical or for new windows while it's searching.Equation
I
4

In my case "Find in Files" function stopped working completely. "Reinstall Windows/Visual Studio!" immediately came to my mind. But there's much simpler solution that worked for me: Spin around on your chair 3 times, clap your hands twice and then press Control + Scroll Lock.

Sources: http://geekswithblogs.net/claraoscura/archive/2008/10/17/125902.aspx http://bloggingabout.net/blogs/edward/archive/2005/01/31/2136.aspx

Incantation answered 18/7, 2010 at 6:54 Comment(1)
Doesn't help and both links are deadVarnado
P
1

Have you "checked" search hidden text?

Often this is the problem.

Pisciform answered 28/1, 2009 at 21:10 Comment(1)
Check out this link: platinumbay.com/blogs/dotneticated/archive/2008/04/28/…Mincemeat
B
1

I tried the following in Visual Studio 2010:

  • Ctrl+Shift+F
  • Ctrl+Break
  • Run devenv /resetsettings
  • Window menu-->Select Reset Window Layout (not sure why this would help?)
  • Control + Scroll Lock
  • Restart Visual Studio

But none of these worked.

My solution was to use "Find All" (Ctrl+Shift+F), but click "Quick Replace" tab instead "Find in Files", and click find next.

For big projects this solution is not enough, it's only an emergency solution.

Boatright answered 2/10, 2013 at 9:52 Comment(0)
S
1

This worked for me:

First: CTRL + SHIFT + F - Then select current document. I made sure that the text was present in that document. It should find the text in the current document.

Second: Swap the search back to search entire solution and it will search entire solution.

Hope this helps someone.

Stony answered 25/10, 2013 at 21:19 Comment(1)
Didn't fix it for me, but led me to the problem. Thanks!Lusatia
I
0

In case others run into this problem and cannot solve it, I found an unexpected solution to this problem.

I had to go through a LOT of combinations to figure this out, including, but not limited to, doing a repair on Visual Studio, uninstalling Visual Studio, reinstalling, disabling all add-ins, running in safe-mode, etc. None of this worked, however, including a complete uninstall and re-install of Visual Studio.

The problem in my case was that if the 'Search up' checkbox is checked within 'Find options', searching on the Entire Solution fails. In the most extreme example, if you close all documents and then search on "a" (without the quotes) or check the 'Use Regular Expressions' checkbox/dropdown and search on ".*" (again, without the quotes) you will still get no results.

If you uncheck the 'Search up' checkbox, however, then everything appears to work just fine.

I don't know for how many others this issue will apply, but I'm guessing that others must be getting snagged by this as well.

Two other related threads on this topic:

  1. Find and Replace Won't Search Entire Solution (ASP Forums)

  2. VS 2008 Replace in Entire Solution Only Works Once (Microsoft Connect)

I hope this helps somebody...

Mike

Invagination answered 29/9, 2009 at 23:30 Comment(2)
Yeah, this didn't really work for me. I sometimes actually use "search up" as a way to try to find more instances, when the lack of "search up" fails.Morrow
Yeah, I don't know then. Clearly this is a very buggy feature, and it's a critical one, so I hope that they fix this at some point. When find/replace fails, it really is a disaster, especially because we might not have any way of knowing that it's failing. :-(Invagination
E
0

Another thing I've found to work is add exactly what you're looking for--preferebly in a place that will break syntax so you can find it later by building--and then search. This will break the find's cyclical find. I had this many times and it was finding only two occurrences endlessly.

Searching for .error

File 1 class

private blah()
{
  something something = ".error";
} 

File 2 css

.error
{
...

Quick fix: File 1

private blah()
{
  something something = ".error";
} 
.error //syntax error will show up in your errors list to find it quickly

Search now works

Equation answered 19/4, 2012 at 14:25 Comment(0)
B
0

Press Control + Scroll Lock

This may help you if you are not finding the results by searching CTRL + SHIFT+F

Bounty answered 9/10, 2014 at 8:52 Comment(0)
C
0
  1. CTRL + SHIFT + F
  2. Choose "Entire Solution ( Including External Items )"

In my case "Entire Solution" was ignoring .config files( we had 100s of those) in VS Professional 2013.

Cutlet answered 16/10, 2015 at 20:43 Comment(0)
L
0

I was trying to find text in the "Entire Solution" that I know existed because I could see an instance the file that was currently open. Yet it said no results found and that it was only searching 67 files, even though my solution has nearly 800 files in it. It turned out the "Look in these file types:" drop down had text typed in it (*.js) from an search I did days ago. I wasn't noticing this at first because I thought you had to check a checkbox for that option to be enabled. PICNIC...

Lusatia answered 24/11, 2015 at 16:57 Comment(0)
M
0

I had a header file search could never see into. I fixed the problem by "add->existing item" the header to the solution explorer.

Moureaux answered 23/3, 2020 at 15:2 Comment(0)
W
0

This issue can still happen in VS2022.

First thing is to make sure you've double-checked all those options in our search - your scope (just this project or whole solution), file endings, match case or not. But assuming all those are as expected and it is still not finding some text that you know is there, try this:

  • Close Visual Studio
  • Look for the .vs folder in the root of your solution, and the FileContentIndex folder within that. Delete that folder.
  • Restart Visual Studio

That very likely will have fixed your search. There will be a slightly longer time to your first search result thereafter, as it rebuilds its cache.

I think this happens because VS is caching the results of your text searches, and the cache can come detatched from reality, especially if you are editing or otherwise changing the file contents outside of VS (e.g. updating from git, or discarding changes with git, or editing in some other editor).

Wrier answered 24/7, 2023 at 15:18 Comment(0)
A
0

I'm running VS on Windows and I noticed my code was with end of line sequence set to "LF". I changed it to "CRLF" (menu Edit / Advanced / Set End Of Line Sequence / CRLF) and VS started once again finding every occurrence of the terms I'm searching.

Aneto answered 1/2, 2024 at 20:15 Comment(1)
Interestingly enough, after this test I changed this configuration back to LF (I need it that way as my code is compiled in Linux), and VS continued finding all the occurrences of text I was searching. It's a weird bug in VS, indeed...Aneto

© 2022 - 2025 — McMap. All rights reserved.