-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Include project diagnostic suppressors in host analyzer execution #75684
Conversation
...tures/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs
Outdated
Show resolved
Hide resolved
@@ -146,6 +146,8 @@ static string GetLanguageSpecificId(string? language, string noLanguageId, strin | |||
// Create driver that holds onto compilation and associated analyzers | |||
var filteredProjectAnalyzers = projectAnalyzers.WhereAsArray(static a => !a.IsWorkspaceDiagnosticAnalyzer()); | |||
var filteredHostAnalyzers = hostAnalyzers.WhereAsArray(static a => !a.IsWorkspaceDiagnosticAnalyzer()); | |||
var filteredProjectSuppressors = filteredProjectAnalyzers.WhereAsArray(static a => a is DiagnosticSuppressor); | |||
filteredHostAnalyzers = filteredHostAnalyzers.AddRange(filteredProjectSuppressors); |
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 path is hit by the test that was failing, and revealed a case of AddRange
causing a problem. It's not clear how well this or other paths are exercised, so I'm certainly concerned with bugs slipping through.
if (hostAnalyzerIds.Any()) | ||
{ | ||
// If any host analyzers are active, make sure to also include any project diagnostic suppressors | ||
hostBuilder.AddRange(projectAnalyzers.WhereAsArray(static a => a is DiagnosticSuppressor)); |
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.
Nit: Don't need "WhereAsArray" here, "Where" should do.
src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/DiagnosticComputer.cs
Outdated
Show resolved
Hide resolved
Debug.Assert(diagnostics.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation).Count()); | ||
|
||
// ⚠️ No obvious way to keep this assertion | ||
//Debug.Assert(diagnostics.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, compilation).Count()); |
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.
📝 Need to understand how important this assertion is. If it is not important, there are multiple parameters that can be removed to simplify this code.
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.
➡️ I removed this assertion and the parameters supporting it.
Fixes #75399