Skip to content

Extension stops indexing .razor (Blazor) component files after a certain number unless you open the file. #6921

Closed
@TrieBr

Description

@TrieBr

Issue Description

I think I finally found the main issue preventing me from using VS Code.

I have dotnet.backgroundAnalysis.compilerDiagnosticsScope and dotnet.backgroundAnalysis.analyzerDiagnosticsScope both set to fullSolution and csharp.maxProjectFileCountForDiagnosticAnalysis set to 9999999999. However it appears that the extension ignores this setting for razor files. After a certain number of razor files, you end up with tons of "Found markup element with unexpected name "SomeComponent" errors until you go open SomeComponent.razor

Steps to Reproduce

  1. Clone my test repo here.
git clone -b test-large-solution https://github.com/TrieBr/blazor-input-bug.git
  1. Open BlazorInputBug/InputBug/Pages/Counter.razor. Notice that "InputTextFour" is underlined and an error shows Found markup element with unexpected name 'InputTextFour'. If this is intended to be a component, add a @using directive for its namespace.. NOTE: Sometimes (flaky) it does work, but you can rename the component to something else like InputTextFive or InputTextSix and observe the same behavior.

  2. Open BlazorInputBug/InputBug/Shared/Inputs/InputTextFour.razor. Then go back to BlazorInputBug/InputBug/Pages/Counter.razor and observe the problem goes away.

  3. Delete most of the other files (BlazorInputBug/InputBug/Shared/Inputs/InputText{11..50.razor}) and command pallete => reload the window. The problem goes away. You can change between InputTextTwo, InputTextThree, InputTextFour, etc and they all work.

  4. Re-add more files (for i in {11..50}; do cp InputText.razor "InputText$i.razor"; done, reload the window and see the problem comes back. You change between InputTextTwo, InputTextThree, InputTextFour, etc and is starts to say "Found markup element with unexpected name"

Expected Behavior

When dotnet.backgroundAnalysis.compilerDiagnosticsScope is set to fullSolution, all razor files should be indexed, and I shouldn't have to go open the ".razor" file to get rid of reference errors.

Actual Behavior

After enough razor files in the solution (my tests seem to break at only 50, but i didn't bisect a smaller number). Intellesense stop working for Blazor components

Logs

Archive.zip

C# log

https://pastebin.com/xwDQQM8k

C# LSP Trace Logs

https://pastebin.com/KrCEXRNw

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions