xsharp.eu • VS 2022: Find In Files sometimes doesn't find existing text
Page 1 of 2

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Wed Jun 14, 2023 10:47 am
by leon-ts
Hi,I will show a strange situation in the following screenshot:
Screenshot.png
Screenshot.png (90.29 KiB) Viewed 1268 times
Screenshot original file:
Screenshot.zip
(67.28 KiB) Downloaded 118 times
I am searching for the 'zfnbl_' function in the current project ('Find All' mode). As you can see in the screenshot, the function exists and the editor sees it (highlighted). But at the same time, the search does not see it (circled in red). The search for this text does not work either as a search in the project, or as a search in the solution. If you perform some manipulations in PRG, for example, fictitious editing (for experiment), the text search for text in the 'Find All' mode starts working.

As far as I understand, X# does not manage search in VS. So this is some kind of bug in VS 2022 itself?
I am using X# 2.16.0.5 integration in VS 2022.

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Thu Jun 15, 2023 5:44 am
by HansjoergP
We have the same problem. There is also an open issue #824 which can be connected to this. For the moment the only thing that seems to help is to use the regular expression search. This search will then find all results.
The problem here probably has something to do with the caching that Visual Studio has had built in for search for some time. It could be that X# does not always correctly report changes in the files and thus the index is not rebuilt.

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Thu Jun 15, 2023 6:18 am
by leon-ts
Hello Hansjoerg,
It turned out that in this PRG, the search does not work not only for the above function, but also for all other functions in this PRG. That is, the problem is related in general to PRG. And I found a few more such PRGs. Apparently, as you suggested, those PRGs didn't make it into the VS search cache for some reason. But if you perform some actions on these PRGs (edit, rename, whatever), then the search in them starts working.

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Thu Jun 15, 2023 12:12 pm
by robert
Guys,
We have tried to contact Microsoft about this, but they are not very helpful in providing information on how to improve this.
Also, information about how to integrate into the new "enhanced" search functionality is completely missing.
Maybe you can push them too to document this for 3rd parties.

Robert

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Thu Jun 15, 2023 12:43 pm
by leon-ts
Robert,
Looks like the search issue is indeed in VS 2022. There is a lot of discussion about it here:
https://developercommunity.visualstudio.com/t/Visual-Studio-2022-Find-And-Replace---Fi/10213540

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Thu Jun 15, 2023 7:46 pm
by ic2
robert post=26644 userid=253 wrote: We have tried to contact Microsoft about this, but they are not very helpful in providing information on how to improve this.
Also, information about how to integrate into the new "enhanced" search functionality is completely missing.
Why doesn't this amaze me?

Dick

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Fri Jun 23, 2023 5:42 am
by leon-ts
Hi,
In the new version of VS 2022 17.6.4, an option has been added to disable indexing for file searches. Disabling this setting does indeed solve the problem. That is, Microsoft for almost a year could not fix the problem and solved it radically :)

Option location
ToolsOptionsText EditorAdvanced: Use indexing with Find in Files

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Sat Jun 24, 2023 6:26 am
by robert
Leonid,
What also helps is to use the option to search for regular expressions. That bypasses the indexes.

Robert

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Sat Jun 24, 2023 11:18 am
by leon-ts
Robert,
Yes, I enabled the "use regular expressions" option before version 17.6.4. But there it was impossible to simply add any text if it contained some special characters. Therefore, it was not a very convenient way to get around the problem.

VS 2022: Find In Files sometimes doesn't find existing text

Posted: Mon Jun 26, 2023 7:15 am
by ArneOrtlinghaus
Special characters can normally be inserted in regular expressions by adding the escape character before each special character.
When it happens it is sometimes also necessary to use the global search over all files with SHIFT CTRL F and not the editor search Ctrl F.
(Of course it disturbes only my daily work, when it happens. But normally I can workaround with this possibility).

Arne