SponsorLinkAnalyzer icon indicating copy to clipboard operation
SponsorLinkAnalyzer copied to clipboard

Only works for direct references, Not transitive?

Open ransagy opened this issue 2 years ago • 3 comments

I've tried to incorporate this in a couple projects where we use Moq (thankfully 4.18 and lower right now) and it doesn't seem to trigger even if Moq is updated to the offending version(s). The only time i got it to trigger and fail the build was when i delibrately added a direct reference to Devlooped.SponsorLink to a project.

ransagy avatar Aug 12 '23 20:08 ransagy

The current version of Moq (4.20.69) does not depend on SponsorLink, which is why the analyzer does not trigger. See https://www.nuget.org/packages/Moq/4.20.69#dependencies-body-tab

CollinAlpert avatar Aug 14 '23 08:08 CollinAlpert

I tried it locally against 4.20.0, I saw the SponsorLink dependency (and its subsquent nag) but the analyzer didn't trigger. I tried debugging it, and indeed the reference is not in ctx.Compliation.ReferencedAssemblyNames. I'm not sure if that's expected or not, though.

ransagy avatar Aug 14 '23 09:08 ransagy

Interesting. I wrote a test which installs version 4.20.0 and it passes. But I can't seem to get the build error. Will need to investigate a bit further.

CollinAlpert avatar Aug 14 '23 14:08 CollinAlpert