-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Ensure both parts of partial methods are analyzed when requesting analyzer diagnostics for a single file #71201
Conversation
Verified that the test fails for `separateFiles = true` and passes for `separateFiles = false`, confirming that SymbolEnd action is not being called when the type has a partial definition in a separate file with partial member implementation part.
…analysis, regardless of whether one or both of them are defined in the same file Fixes dotnet#71149
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 2)
@333fred could you ptal. thanks! |
Yes, this should fix that issue. I tried adding the unit test for the analyzer first and get it to fail. However, the MS.CA.Testing library runs the test by computing diagnostics over the whole compilation, it does not mimic IDE open file analysis that requests diagnostics for a single file at a time. This bug only repros with the latter approach, hence adding an IDE analyzer test won’t help with respect to this fix. |
@mavasani Gotcha. |
Thanks! |
Fixes #71149
This is a bug in the core analyzer driver that only happens when we have a partial implementation part of a partial method in a separate file (doesn't matter if it is a regular file or a generated file), and this partial type definition has no other members defined. First commit in this PR: 65ca155 shows the unit test that fails when
separateFiles = true
without the fix.The fix is to ensure we analyze both parts of partial when requesting analyzer diagnostics for a single file (happens for open file analysis for IDE live analysis)