Skip to content

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review September 4, 2025 16:24
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner September 4, 2025 16:24
@@ -1,493 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire complex type was never used in product scenarios. But was only called from tests... yikes.


// In this case, the analyzers are ran twice. This appears to be a bug in SkippedHostAnalyzersInfo.Create, because it calls
// HostDiagnosticAnalyzers.CreateProjectDiagnosticAnalyzersPerReference which already filters out references, it doesn't return any
// references to skip.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaay... a test that was only validating broken behavior from a component not actually called from real product code...

@CyrusNajmabadi CyrusNajmabadi force-pushed the removeCodeOnlyCalledByTests branch from d9f15e9 to aff20ed Compare September 4, 2025 17:31
Comment on lines +640 to +641
Assert.Equal(1, diagnosticsMapResults.Length);
var diagnostic = diagnosticsMapResults.Single();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Assert.Equal(1, diagnosticsMapResults.Length);
var diagnostic = diagnosticsMapResults.Single();
var diagnostic = Assert.Single(diagnosticsMapResults);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will roll into followup. thanks!

var analyzerResults = diagnosticsMapResults.Diagnostics.Single();
Assert.Equal(analyzerHostId, analyzerResults.Item1);
Assert.Equal(1, analyzerResults.Item2.Semantic.Length);
var analyzerResults = diagnosticsMapResults.Single();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var analyzerResults = diagnosticsMapResults.Single();

// references to skip.
Assert.Equal(2, diagnosticsMapResults.Diagnostics.Length);
// We should only get one diagnostic as the two analyzers have the same ID and will be deduped.
Assert.Equal(1, diagnosticsMapResults.Length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Assert.Equal(1, diagnosticsMapResults.Length);
Assert.Single(diagnosticsMapResults);

@CyrusNajmabadi CyrusNajmabadi merged commit 946116b into dotnet:main Sep 4, 2025
24 of 25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the removeCodeOnlyCalledByTests branch September 4, 2025 18:58
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Sep 4, 2025
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants