Remove IDE heuristic for IsCompilationEndAnalyzer#48762
Conversation
This comment has been minimized.
This comment has been minimized.
|
@mavasani Can you fill in this table?
|
|
@sharwell That is not in scope of this PR - this PR just changes the existing logic for determining if a diagnostic reported from build should be treated as a build-only/compilation-end diagnostic or not. Before this PR, that determination was done by an expensive, fragile heuristic that involves invoking callbacks into the analyzer. After this PR, that determination is done via an explicit custom tag on the diagnostic descriptors registered by the analyzer. |
|
To clarify my comment further - FSA setting is not being used to determine if a build diagnostic determined to be a compilation-end diagnostic should be treated as an intellisense supported diagnostic or not (probably it should be). However, those semantics are not being changed in this PR, so changing anything w.r.t. FSA setting is completely orthogonal to any work being done to resolve #47754 |
|
@mavasani That's fine (and would be fine to indicate in the table what the follow-up behavior will be). I'm mostly trying to understand the impact this will have on users in each of the four states listed above. For each of the four states, the following could be impacted:
|
|
@sharwell I performed bunch of validations and hopefully the results below should give us much stronger confidence in the experience: Current Experience
New ExperienceAnalyzer package with custom tagExactly identical to Analyzer package without custom tag
Run Code Analysis command ExperienceThis command only force completes analysis for the entire project, it does not override FSA setting. For example, if FSA is off, running this command will only force complete non-compilation end actions for the entire project. This is done specifically to ensure that the command plays nicely with background analysis and generates the same diagnostics as if user had opened every file in the project. |
| /// Indicates that the diagnostic is a compilation end diagnostic reported | ||
| /// from a compilation end action. | ||
| /// </summary> | ||
| public const string CompilationEnd = nameof(CompilationEnd); |
There was a problem hiding this comment.
@dotnet/roslyn-compiler This is the only compiler change in this PR (along with the corresponding public API change in below file). Please see #47754 for more context.
There was a problem hiding this comment.
Plan is to mark this obsolete (unused) if we ever re-implement the deduplication algorithm to not need it.
…end actions Required to account for IDE experience for compilation end diagnostics as a consequence of dotnet/roslyn#48762 As many security rules are compilation end diagnostics, I have made the new parameter `isReportedAtCompilationEnd` a required parameter for `SecurityHelpers.CreateDiagnosticDescriptor` helper.
333fred
left a comment
There was a problem hiding this comment.
Compiler changes LGTM (commit 7)
...ditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs
Outdated
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs
Outdated
Show resolved
Hide resolved
sharwell
left a comment
There was a problem hiding this comment.
Looks good aside from the concern of a possible test gap
|
Thanks @sharwell - I have added the requested test. |
|
Hello @mavasani! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
…end actions Required to account for IDE experience for compilation end diagnostics as a consequence of dotnet/roslyn#48762 As many security rules are compilation end diagnostics, I have made the new parameter `isReportedAtCompilationEnd` a required parameter for `SecurityHelpers.CreateDiagnosticDescriptor` helper.
Addresses the core functionality part of #47754 (comment).
A follow-up change will address the second part of generating an IDE-only diagnostic when an analyzer reports a diagnostic in CompilationEnd action which does not have the CompilationEnd custom tag.