-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Implement de-duplication of NuGet and VSIX analyzer execution and diagnostics #41687
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
Conversation
…uGet and VSIX analyzers reporting same/overlapping diagnostic IDs - dotnet#18818 Verified all the added unit tests fail currently as both NuGet and VSIX analyzers always execute and no diagnostic filtering is done.
| /// <summary> | ||
| /// Information about host analyzers that can be skipped for the given project ID. | ||
| /// </summary> | ||
| private readonly ConditionalWeakTable<ProjectId, ISkippedAnalyzersInfo> _skippedAnalyzersInfo; |
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.
❔ Any reason to not use the same IReadOnlyList<AnalyzerReference> key that CodeFixService uses?
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.
We only have the project ID in the project removal callback when we clear this cache entry.
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.
Wouldn't it clear itself if we use CWT?
src/Workspaces/Core/Portable/Diagnostics/ISkippedAnalyzersInfo.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Diagnostics/ISkippedAnalyzersInfo.cs
Outdated
Show resolved
Hide resolved
| var asyncToken = _asyncOperationListener.BeginAsyncOperation(nameof(AnalyzeInProcAsync)); | ||
| var _ = FireAndForgetReportAnalyzerPerformanceAsync(project, client, analysisResult, cancellationToken).CompletesAsyncOperation(asyncToken); | ||
|
|
||
| // get skipped analyzers info |
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.
Comment is redundant
| // get skipped analyzers info |
| /// <summary> | ||
| /// Information about host analyzers that can be skipped for the given project analyzers. | ||
| /// </summary> | ||
| private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, ISkippedAnalyzersInfo> _skippedAnalyzersInfo; |
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.
@sharwell CWT feedback addressed.
| return _skippedAnalyzersInfo.GetValue(project.AnalyzerReferences, createValueCallback); | ||
| } | ||
|
|
||
| public ISkippedAnalyzersInfo GetOrCreateSkippedAnalyzersInfo(Project project, IEnumerable<AnalyzerReference> hostAnalyzers) |
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.
This API is used for computing this info in OOP, as we don't have HostDiagnosticAnalyzers available in OOP.
…e is an existing unit test which caught this issue.
|
Thank you @sharwell |
ghost
left a comment
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.
Auto-approval
Implements the design in #18818 for analyzers. De-duping for code actions will be implemented in a follow-up PR.
First commit implements the unit tests as per the design mentioned in #18818 - all the added unit tests failed after this commit
Second commit implements the above logic in the IDE diagnostic analyzer engine.