39

I've just started to use Visual Studio 2022 and I'm trying to search something via ctrl+F and 'Find All' function but it is not finding the key that I'm searching for, even though I know there is such a key in a file in one of my projects in the solution. Do I miss a configuration step after a clean installation?

Note: I am able to find the key when I search in 'Current Document'

zalky
  • 659
  • 1
  • 7
  • 12
  • I've found that whenever I try to search across an entire solution, I often have to press enter on my keyboard twice for it to attempt to find something. The first enter press gets ignored. It has always been this way for me. – Timothy G. Jun 09 '22 at 17:16
  • @TimothyG. I haven't come across with such a problem, enter key works fine in my case. Furthermore, I've always been using 'Find All' button rather than using the enter key itself. – zalky Jul 08 '22 at 10:24
  • In version 17.4.5, it still does not listing anything via "find all". The only workaround that solves it for me, is checking “use regular expressions” that seems to work... – SiL3NC3 Feb 20 '23 at 09:46

7 Answers7

16

Thanks guys

Changed the "Look in" setting to the root folder path of my solution instead of selecting the "Entire Solution" option. (Use the three dots button.) This returned the results i was expecting. This worked!!!

krutika
  • 161
  • 1
  • 2
  • 1
    After 7 years of SO silence, I'm so glad you shared this answer @krutika - it worked for me. – DeveloperDan Dec 20 '22 at 14:07
  • This worked for me! Thank you. I've been using grepWin but can finally search again just using VS. – Waldron Apr 25 '23 at 19:11
  • This is for `Find in Files` command, not `Quick Find` or `Quick Replace` that we get by pressing Ctrl+F or Ctrl+H shortcut! in quick find/replace window there is no such three dots button. – S.Serpooshan Jun 13 '23 at 14:55
11

There seems to be a bug in the caching mechanism. I find I have to use all sorts of stupid tricks to force it to clear its cache and run the search properly, e.g. adding a nonsense word to one of my files, running the find in files for that word (which will succeed), removing it and then running my original query again (which will now succeed). It's very annoying.

Kaitain
  • 911
  • 12
  • 19
  • I had this same nonsense bug and this worked for me on Visual Studio 2022. Thanks! – Rick Wolff Sep 20 '22 at 17:26
  • 1
    Apparently they have fixed it in the latest version. (Unconfirmed.) – Kaitain Sep 21 '22 at 18:06
  • fingers crossed... – Rick Wolff Sep 21 '22 at 19:12
  • 7
    Still broken... – msteel9999 Oct 03 '22 at 09:06
  • 1
    I just updated to 17.3.5 because of this issue and it did not fix it. This, however, did. Thanks! – Mideus Oct 10 '22 at 15:18
  • 1
    This is quite scary bug, I encountered it today on VS 2022 17.3.5, the last time I had it was on some previous VS versions. It might cause committing something broken. Honestly don't understand how this is not fixed... – xhafan Nov 08 '22 at 20:18
  • 4
    Still broken in VS 17.3.6. (Using English GB language not Turkish) Was only finding *some* results. It missed a result that was literally on the screen in front of me, in a file that was part of the solution. – Bucket Nov 09 '22 at 11:26
  • 1
    Still broken in VS 2022 17.4.1 . This trick helped me, thanks! – xhafan Nov 25 '22 at 11:10
  • 6
    I reported the issue on developercommunity.visualstudio.com, please upvote it here: https://developercommunity.visualstudio.com/t/Visual-Studio-2022-Find-And-Replace---Fi/10213540? – xhafan Nov 25 '22 at 14:52
  • @xhafan, super idea, but I'm getting "Unexpected error. Sorry, we couldn't send your vote. Please retry now or sign out, sign in, and try again" - probably they don't want it to be upvoted anymore. – Jarek C Dec 20 '22 at 12:49
  • 1
    Still broken in 17.5.0 The fix above still works, however. The voting on the developercommunity site is still broken too. Yay Microsoft – BardMorgan Feb 24 '23 at 17:39
  • still broken 17.5.5 – tim May 07 '23 at 00:51
  • 1
    Still broken in 17.6.4, I'm sure it worked in some previous version. – Velcro Jul 06 '23 at 16:53
  • Still broken in 17.6.5, and voting on developercommunity is also still broken - but at least the issue now it has a tag that says "Fixed - Pending release" – Lars Kristensen Jul 24 '23 at 12:59
9

Visual Studio currently has a bug that is fixed and pending release.

I assume that you are using Turkish region format settings, based on your username. This bug affects users with Turkish regional settings. Probably you have been experiencing the same problem.

Source: Find in entire solution (Ctrl + Shift + F) cannot match queries containing lowercase 'i' with Turkish region format settings

Edit: The fix has been released.

Sinan ILYAS
  • 1,212
  • 1
  • 12
  • 10
  • 1
    Thanks a lot, after I had checked the link you've provided, I realized that my issue is caused by what you have mentioned above. I saw a workaround comment in the link you've shared as following; 'Opening the start menu, typing in ‘Region’ and selecting ‘Region Control Panel’, and changing your Windows UI ‘Format’ settings from ‘Turkish’ to another locale.' I've done this workaround and now I don't have any problems at all with searching, this will work until the pending release is completed. – zalky Jul 08 '22 at 10:31
  • 3
    I'm not using Turkish still getting caching issues where the same search term won't always work – msteel9999 Oct 03 '22 at 09:07
  • @msteel9999 It's probably because of another bug or something. Because I had no issues since the fix is released. – Sinan ILYAS Dec 05 '22 at 12:28
9

After closing visual studio, then deleting the hidden .vs folder in the folder where the solution file lives

This is my general fix for most issues in Visual studio, and it often solves the problems.

Laurent Couvidou
  • 32,354
  • 3
  • 30
  • 46
Gerrie Pretorius
  • 3,381
  • 2
  • 31
  • 34
  • Closed VS then deleted every folder in %TEMP% that started with VS. Re-opened VS and tried the search again. This did NOT solve the issue for me. – Bucket Nov 09 '22 at 11:33
  • 1
    @Bucket the .vs folder that I am referring to is the hidden folder named .vs in the directory where your visual studio solution is, not in the %TEMP% directory. In the temp directory I deleted everything that could be deleted, regardless of the name – Gerrie Pretorius Nov 10 '22 at 12:20
  • 4
    I had this same issue in latest version of Visual Studio 2022 (English/US). Closing visual studio and deleting the .vs folder did the trick – Robert Corvus Nov 18 '22 at 16:51
  • 1
    Same here, so I've removed references to the %TEMP% folder from the answer – Laurent Couvidou Jul 19 '23 at 09:17
4

VS2022 v17.4.3

I was having a similar issue and tracked it down to the selected file types in the Find in Files tab. It was originally set to file types that I don't work with, e.g. *.c, *.cpp. Once I set the File Types to the ones I do work with - e.g. *.cs, *.cshtml - the find worked as expected. Find in Files - File Types

  • the simplest solution... IDK why this setting was different than I usually took. Thanks. – Hagen Apr 18 '23 at 16:41
1

In the "Find in Files" tab of the "Find and Replace" window i did the following:

Changed the "Look in" setting to the root folder path of my solution instead of selecting the "Entire Solution" option. (Use the three dots button.) This returned the results i was expecting.

If your solution setup is particularly complicated you can search multiple folder paths at once using a semi colon as a separator.

That search seems to take a moment to return every time I search that way. So I'm guessing this kind of search does not cache it's results in VS.

Bucket
  • 514
  • 6
  • 10
0

And, I still have this issue with the latest Visual Studio 2022 (17.4.2). For me, it seems to be related to using the "Show All Files" view for each of the projects in the Solution. If I disable that for all of the projects, Find in Files seems to work as expected. It continues to work for some time if I switch back to "Show All Files" view, until it doesn't.

I have all of my projects setup using "Show All Files" though, so my overall experience is that at least once a day "Find In Files" just stops working.

MarkD9
  • 1
  • 1