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

This forum is meant for questions and discussions about the X# language and tools
leon-ts
Posts: 429
Joined: Fri Feb 03, 2017 1:43 pm

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

Post by leon-ts »

Hi,I will show a strange situation in the following screenshot:
Screenshot.png
Screenshot.png (90.29 KiB) Viewed 671 times
Screenshot original file:
Screenshot.zip
(67.28 KiB) Downloaded 54 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.
Best regards,
Leonid
HansjoergP
Posts: 97
Joined: Mon Jul 25, 2016 3:58 pm
Location: Italy

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

Post 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.
leon-ts
Posts: 429
Joined: Fri Feb 03, 2017 1:43 pm

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

Post 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.
Best regards,
Leonid
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

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

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
leon-ts
Posts: 429
Joined: Fri Feb 03, 2017 1:43 pm

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

Post 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
Best regards,
Leonid
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

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

Post 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
leon-ts
Posts: 429
Joined: Fri Feb 03, 2017 1:43 pm

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

Post 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
Best regards,
Leonid
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

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

Post by robert »

Leonid,
What also helps is to use the option to search for regular expressions. That bypasses the indexes.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
leon-ts
Posts: 429
Joined: Fri Feb 03, 2017 1:43 pm

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

Post 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.
Best regards,
Leonid
User avatar
ArneOrtlinghaus
Posts: 384
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

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

Post 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
Post Reply