-
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
True-negative in GetUsedAssemblyReferences #66188
Comments
I wasn't able to repro as unittest (copied below) or with provided repro steps. Could you set a breakpoint in the analyzer after When I checkout your PR and run
Here's the unittest I tried and debugged (
|
That's precisely the true-negative bug I'm reporting (thanks for taking the time to do the repro from another repo!). The problem is that Newtonsoft is declared as a PackageReference in that project and despite it is not referenced in the code, |
Notes from offline chat with @stan-sz: |
Isolated a repro (see below). A significant variable is whether documentation mode is turned on. So, as far as I can tell, this is by design and you should turn on documentation mode to resolve this problem.
|
What is the switch to enable documentation mode? |
The |
From discussion with @stan-sz, it would be good to improve the documentation. The xml doc for |
I just hit the same thing. It was non-intuitive that |
Version Used: 4.4.0
Steps to Reproduce:
Given:
foo.csproj
:and
foo.cs
Repro requires an analyzer that dumps the output of
GetUsedAssemblyReferences
. An example implementation is in https://github.com/dfederm/ReferenceTrimmer/pull/20/files, the failed test case (where the above repo is taken from) isdotnet test ReferenceTrimmer.sln --filter UnusedPackageReference
Expected Behavior:
The result of
CSharpCompilation.GetUsedAssemblyReferences
does not contain Newtonsoft.Json.dll referenceActual Behavior:
The result of
CSharpCompilation.GetUsedAssemblyReferences
does contain<home>\.nuget\packages\newtonsoft.json\13.0.2\lib\net6.0\Newtonsoft.Json.dll
The text was updated successfully, but these errors were encountered: