David Morton
David Morton

Reputation: 16505

Visual Studio find doesn't find all possibilities

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?

Upvotes: 9

Views: 11057

Answers (14)

Marcio
Marcio

Reputation: 76

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.

Upvotes: 0

karlis
karlis

Reputation: 920

Have you "checked" search hidden text?

Often this is the problem.

Upvotes: 1

iGSam
iGSam

Reputation: 66

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

Upvotes: 4

Jinlye
Jinlye

Reputation: 2234

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).

Upvotes: 0

Archon 808
Archon 808

Reputation: 200

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

Upvotes: 0

xr280xr
xr280xr

Reputation: 13302

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...

Upvotes: 0

LEO Ullas
LEO Ullas

Reputation: 1

  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.

Upvotes: 0

RayLoveless
RayLoveless

Reputation: 21058

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.

Upvotes: 1

Roman Starkov
Roman Starkov

Reputation: 61402

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.

Upvotes: 5

Yohanes Nurcahyo
Yohanes Nurcahyo

Reputation: 621

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.

Upvotes: 1

user4124505
user4124505

Reputation: 1

Press Control + Scroll Lock

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

Upvotes: 0

Bluebaron
Bluebaron

Reputation: 2516

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

Upvotes: 0

Mike Rosenblum
Mike Rosenblum

Reputation: 12157

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

Upvotes: 0

DavGarcia
DavGarcia

Reputation: 18792

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.

Upvotes: 4

Related Questions