Cshtml references not properly shown
Type: Bug
Issue Description
In a web MVC project, Go to References does not always find a field referenced in a *.Cshtml file.
After opening a Cshtml file that contains a reference to said field, Go to References now sees the Cshtml reference, but does not allow you to open the file.
-
Here you can see that the
cshtmlreferences are not shown for theNumberOfResultsfield. -
After opening the
Index.cshtmlfile,Go to Referencesnow shows the cshtml references. -
Trying to open one of the references results in another error.
Expected behavior
I'd expect the Go to References to:
- show all the references (even the
cshtmlones) - be able to navigate to the references in the
cshtmlfiles.
Environment information
Extension version: 2.14.8 VS Code version: Code 1.85.1 (Universal) (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:06.308Z) OS version: Darwin arm64 23.2.0 Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Apple M2 Max (12 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | 5, 2, 2 |
| Memory (System) | 32.00GB (2.14GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Tagging @davidwengier for the Razor side - I cannot remember if this is expected behavior and you already have an issue tracking it, or if this something we need to fix on the Roslyn side. Do we have the generated source for non-open Razor files?
We do, but VS Code automatically closes the documents after a while. We re-open them (hidden) when we get requests for their corresponding razor/cshtml document, but a Find Refs from Roslyn would never hit us, so it wouldn't happen.
We do, but VS Code automatically closes the documents after a while. We re-open them (hidden) when we get requests for their corresponding razor/cshtml document, but a Find Refs from Roslyn would never hit us, so it wouldn't happen.
I assume this issue is resolved once we move to source generators right? If so, do you have an issue tracking that so I can dupe against it?
I would leave this for Razor triage to decide, as we could dupe it, or we could do something else if priorities and timeframes dictate. If its easier for you to move these to the Razor repo in order to do that, that would be fine.
Thanks - I'll move over to the Razor side.
(10 months later) Any news?