Skip to content

Commit 23f83bd

Browse files
committed
Fix scenario where multiple packages share product name
i.e. ThisAssembly. We want to report only once for all the packages, so it's expected to not find
1 parent 93df7c7 commit 23f83bd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,13 @@ public override void Initialize(AnalysisContext context)
6464
// NOTE: even if we don't report the diagnostic, we still set the status so other analyzers can use it.
6565
ctx.RegisterCompilationEndAction(ctx =>
6666
{
67+
// NOTE: for multiple projects with the same product name, we only report one diagnostic,
68+
// so it's expected to NOT get a diagnostic back. Also, we don't want to report
69+
// multiple diagnostics for each project in a solution that uses the same product.
6770
if (Diagnostics.Pop(Funding.Product) is Diagnostic diagnostic)
6871
{
6972
ctx.ReportDiagnostic(diagnostic);
7073
}
71-
else
72-
{
73-
// This should never happen and would be a bug.
74-
Debug.Assert(true, "We should have provided a diagnostic of some kind for " + Funding.Product);
75-
// We'll report it as unknown as a fallback for now.
76-
ctx.ReportDiagnostic(Diagnostic.Create(descriptors[SponsorStatus.Unknown], null,
77-
properties: ImmutableDictionary.Create<string, string?>().Add(nameof(SponsorStatus), nameof(SponsorStatus.Unknown)),
78-
Funding.Product, Sponsorables.Keys.Humanize(Resources.Or)));
79-
}
8074
});
8175
}
8276
});

0 commit comments

Comments
 (0)