Rider (2021.3.2) won't search for text in non-standard files?

This is not specific to this version, it has been a problem for a long time I think.

I have many custom script files that are compiled as embedded resources. They are just text files with my own custom extensions.

Find in Files will not search these files even though they are in the solution. Whether or not I use a file mask it finds nothing. Choosing "Include non-solution items" also does not help.

This is annoying because I need to do a search and replace in dozens or hundreds of script files but Rider can't do it.

Comment actions Permalink
Official comment

Would you mind trying the `Find in Files` feature:

  1. Please ensure your scripts are indexed:
    1.1. Switch `Solution Explorer` to `File System`;
    1.2. Ensure there is no `no index` text next to the folder with your scripts;
    1.3. In case you see `no index` next to the folder with your scripts, right-click on the folder, select `Include`;
  2. Open `Find in Files` window via `Edit | Find | Find in Files` ( Ctrl+Shift+F in VS keymap )
  3. Try searching with this view.

Please let me know if it does not work.

Comment actions Permalink

The file does not say 'no index'. If I right-click it from File System view, I can choose Exclude, not Include.

The file is nested under another file, but even if I un-nest it I still can't find any text in it.

The search doesn't work even when the scope is set specifically to that file.

It's not a matter of case/whole-word/regex either as those are not set, and even toggling them all on and off doesn't help.

The filter popup at the top right is also set to "Anywhere".

Comment actions Permalink
The possible scenario I see at this moment is that your scripts are compiled into .resource files which store the data in binary format. It prevents Rider from finding text in these files. The possible solution I can suggest is to compile your resources into .resx files or include your custom scripts sources as they are into the project.

If it does not help, would you mind describing your use case in more detail and sharing the details below, so we can reproduce your scenario and elaborate if there is a compatible solution?

1. How exactly your scripts were compiled into resources? Was it a ResGen tool?
2. Is there a reason why you prefer including the scripts in the project as resources instead of including them as-is?
3. Screenshot of explorer view with `File System` toggled;
4. To reproduce the same scenario, we would appreciate it if you could share:
  4.1. The sample of your custom script (source file);
  4.2. Sample project;
  4.3. The steps to reproduce the issue;
Comment actions Permalink

k I've done more testing and here are more details:

 - the extension I use is .ri (I don't think it's an issue)

 - I associate this extension with my own external program to edit the files (it used to be that I could tell VS + R# to use a specific external program, but instead Rider wants to only use the Windows associated program)

 - If I add, say, test.txt or test.abc, search works. If I add test.ri, search does not work.

 - I notice that if I right click test.abc, I get the option "Associate with File Type...". This option is not available if I rename the file to test.ri.

 - I use <EmbeddedResource Include="**\*.ri" /> to mark ri files as embedded resource. If I add a similar line for .abc files, it does not cause the problem with .abc files.

 - If I choose "Associate with File Type..." and then "Open matching files in associated application", then I lose the "Associate with File Type..." option and also search stops working, so I think that is it.


Comment actions Permalink

I assume I was able to reproduce a similar behavior. Would you mind trying the following workaround?

  • Open `File | Settings | Editor | File Types`;
  • Click `+` on the top of the list with the known file types;
  • Name your file type somehow, click `OK`;
  • Click `+` under the `File name patterns:`;
  • Type `*.ri` there;
  • Press `Save`;
  • Reopen your solution;

I hope this helps!

If not, would you mind sharing the left details I requested before?

You can send the files to me via the Upload Service and let me know the Upload ID.
Comment actions Permalink

This removes the file pattern from "Files opened in associated applications" and then I can no longer use my own editor. It does fix the search issue, so I can at least switch back and forth as needed.

The issue seems to be then that "Files opened in associated applications" are not available for searching for some reason.

Comment actions Permalink

So, this is a bug, right? Will it be fixed? "Cannot search text in files that are opened in associated applications".

Comment actions Permalink

The files that are associated with a file type `Files opened in associated applications` are considered to be binary from IDE perspective, hence the search does not work with them as per design.
Regrettably, the only solution is to write a plugin, that will add a similar file type that will not be considered by IDE as binary but regrettably, there is no such plugin yet.


Please sign in to leave a comment.