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

Closing a document brings back stale diagnostics #70042

Closed
sharwell opened this issue Sep 20, 2023 · 11 comments
Closed

Closing a document brings back stale diagnostics #70042

sharwell opened this issue Sep 20, 2023 · 11 comments
Assignees
Milestone

Comments

@sharwell
Copy link
Member

Version Used:

  • Analysis scope set to Open Documents via solution explorer
  • LSP pull diagnostics enabled

Steps to Reproduce:

  1. Introduce a build warning
  2. Build the project
  3. Open the document with the build warning
  4. Fix the build warning
  5. Close the document with the build warning

Expected Behavior:

  • After step (2), the warning appears in the error list
  • After step (4), the warning disappears from the error list

Actual Behavior:

  • After step (2), the warning appears in the error list
  • After step (4), the warning disappears from the error list
  • After step (5), the warning reappears in the error list
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 20, 2023
@CyrusNajmabadi
Copy link
Member

@AmadeusW @kayle

@kayle
Copy link

kayle commented Sep 21, 2023

What would you expect if you close the file in step 5 without saving?

@CyrusNajmabadi
Copy link
Member

What would you expect if you close the file in step 5 without saving?

the diagnostic would be gone. you'd have to rebuild to get it again. we don't track the impacts of mutations (it's nearly impossible, since any change anywhere can have impacts on diagnostics everywhere).

so you might change code in a different file which fixes the diag in this file, save it, then not save this file that contains the diagnostic. That shouldn't bring the diagnostic back.

This is the experience in roslyn today, and it's fine. Things always move forward. Builds represent results for an event in the past. And even if varying changes happen (or get tossed) past that point, it still represents the past, and may have to to be rerun to represent the present.

@kayle
Copy link

kayle commented Sep 26, 2023

The latest dogfooding build should now match the expected behavior.

@CyrusNajmabadi
Copy link
Member

Thanks @kayle !

@arunchndr arunchndr added this to the 17.9 milestone Oct 9, 2023
@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 9, 2023
@mavasani
Copy link
Contributor

@kayle @CyrusNajmabadi The original issue described by @sharwell seems to be fixed in the latest build. However, I am seeing duplicate and stale diagnostics with Full solution analysis enabled. See the repro below:

LSP_FSA

@mavasani mavasani assigned kayle and CyrusNajmabadi and unassigned mavasani Oct 10, 2023
@kayle
Copy link

kayle commented Oct 10, 2023

Thanks @mavasani - I can fix that issue.

What do you expect after closing the document? Currently the warning will go away until the next workspace request regenerates it.

@CyrusNajmabadi
Copy link
Member

Currently the warning will go away until the next workspace request regenerates it.

That is my expectation. "Latest wins". So the document superseded the workspace. Until workspace runs again, the warning will be gone.

@CyrusNajmabadi
Copy link
Member

@kayle can you link to your PR for this? I'd like to close this out. Thanks!

@kayle
Copy link

kayle commented Oct 20, 2023

@CyrusNajmabadi
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants