razor icon indicating copy to clipboard operation
razor copied to clipboard

Blazor - Build vs Build + Intellisense errors count after build differs (144 vs 38)

Open janseris opened this issue 3 years ago • 3 comments

Describe the bug: Build shows 144 errors Build + Intellisense shows 38 errors Sample project: Ordinace.zip

https://user-images.githubusercontent.com/64279914/188288427-8c02be72-93f5-440f-9a33-a7444d99b46b.mp4

Version used: e.g. VS2022 17.3.3

To reproduce:

Try build project. For detailed reproduction, see attached video.

Expected behavior: Number of Build + Intellisense errors is greater or equal than number of Build errors

Actual behavior: Number of Build + Intellisense errors is much less than number of Build errors

Additional context: Another example: Ordinace2.zip build errors and warnings count

janseris avatar Sep 03 '22 21:09 janseris

@dibarbet @mavasani Do you have any more context on this? Is this expected?

It seems like FSA has something to do with this, because I get 38 errors as per the repro video, but if I open another file that has errors, that numbers goes to 76, and doesn't go down when I close the document. I remember seeing some commenta bout a known issue with LSP and FSA recently, maybe?

davidwengier avatar Sep 05 '22 03:09 davidwengier

@davidwengier the expectation is that build + intellisense will show you all errors from the build + intellisense errors, so there's definitely a problem here as it isn't showing all the build errors. Note that its totally possible for the intellisense only column to show less errors - for example missing closed docs or compilation end diagnostics when FSA is off.

After playing around with it for a few minutes, I can repro this when FSA is off and C# LSP pull diagnostics is off. What I did

  1. Add errors in two different blazor files
  2. Add an error in a CS file.
  3. Close everything except 1 blazor file, then restart VS (just to get to a clean state).
  4. Open the sln, note the initial error in the open blazor file in the error list.
  5. Build the solution and note the following behavior. missing_errors

This does not repro when C# LSP pull diagnostics is on, so I'm guessing its undefined behavior due to Razor being on LSP and Roslyn not.

but if I open another file that has errors, that numbers goes to 76, and doesn't go down when I close the document

This appears to be a bug in C# projects as well. I will take a look as once the document is closed the intellisense errors should go away.

dibarbet avatar Sep 06 '22 18:09 dibarbet

@dibarbet -- Were you planning to follow up on this? Do you have a bug tracking this on the C# side?

DustinCampbell avatar Sep 15 '22 21:09 DustinCampbell

closing - C# LSP pull diagnostics (where the issue was not present) is now the only diagnostic experience

dibarbet avatar Mar 10 '25 20:03 dibarbet