Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation End diagnostics not displayed correctly #76693

Open
bjornhellander opened this issue Jan 9, 2025 · 2 comments
Open

Compilation End diagnostics not displayed correctly #76693

bjornhellander opened this issue Jan 9, 2025 · 2 comments
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@bjornhellander
Copy link

Version Used: Compiled against Roslyn 4.12.0. Running in Visual Studio 17.12.3.

Steps to Reproduce:

I am having problems with an analyzer we are developing, I created a simpler solution from the analyzer template to illustrate the problems, with this analyzer in it:
https://github.com/bjornhellander/CompilationEndAnalyzerProblem1/blob/master/CompilationEndAnalyzerProblem1/CompilationEndAnalyzerProblem1/CompilationEndAnalyzerProblem1Analyzer.cs

If I build the nuget package from this solution and reference it from another project, I expect a warning for each named type symbol.

  1. I see the warnings consistently in the Output window.
  2. I see the warnings (most of the time?) in the Error List after a complete rebuild.
  3. If I build again (just "Build Solution") without making any changes, the warnings are gone from the Error List, regardless of if I select Build Only or e.g. Build + Intellisense.
  4. If I instead make a change and build, then I see the warnings from the project being compiled, with warnings from any other projects gone again.
  5. I never see the warnings as squigglies in the code.
    I would appreciate any help you can offer on what's going on and if I should do things in another way. This is working really badly for me.
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 9, 2025
@CyrusNajmabadi
Copy link
Member

We don't live run CompilationEnd analyzers in the ide because of the high cost of them. They are only run when you build, and then show up in the "build" section of the error list.

@bjornhellander
Copy link
Author

Thanks for the reply!

I buy that you don't live run them. But are the reported diagnostics supposed to disappear in VS after another build? For example points 3 & 4: If I build again and only one project is actually built during that build, all diagnostics for the other projects are in my mind still relevant, but they are no longer displayed in VS. Is that intentional?

And regarding point 5: Are VS squigglies only based on "live" compilation, even for analyzers that are intentionally not run live? Is that why I never see them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants