Skip to content
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

Showing multiple nuget dependencies disregard of target framework in package.config file #4083

Closed
MoumitaManna opened this issue May 28, 2021 · 2 comments
Labels
analyzer About the analyzer tool bug Issues that are considered to be bugs hacktoberfest An issue suitable for the Hacktoberfest help wanted An issue where third-party help is wanted on

Comments

@MoumitaManna
Copy link

Hi ORT Team,

We tried to run ORT on .cs projects for nuget dependencies and found that the analyzer-result.json getting generated shows all the dependencies irrespective of the target framework mentioned in the packages.config file for the .cs projects.
For example: PFA the packages.config file which shows only two dependencies and also the generated analyzer-result.json file
packages.config.txt
analyzer-result.json.txt

The target framework mentioned in the packages.config file is .netstandard2.0 so instead of picking the dependencies for .netstandard2.0 only, ORT is getting all the dependencies for all the frameworks and getting the unique dependencies out of it which are then shown in the ORT result i.e. analyzer-result.json.

I suppose this is a bug as ORT shall show only the nuget dependencies for the target framework mentioned in the packages.config file.

Can you please let us know whether it is working as expected or its a bug. And if its a bug then when will it be resolved.

Regards,
Moumita

@sschuberth
Copy link
Member

I consider this to be a bug / limitation of the current implementation. I'm not a .NET guy, but I guess what needs to be done is to add

    @JacksonXmlProperty(isAttribute = true)
    val targetFramework: String? = null

to

@JsonIgnoreProperties(ignoreUnknown = true)
private data class Package(
@JacksonXmlProperty(isAttribute = true)
val id: String,
@JacksonXmlProperty(isAttribute = true)
val version: String
)

and then somehow take the targetFramework into account when building the dependency tree in

fun buildDependencyTree(
references: Collection<Identifier>,
dependencies: MutableCollection<PackageReference>,
packages: MutableCollection<Package>,
issues: MutableCollection<OrtIssue>
) {

@sschuberth sschuberth added analyzer About the analyzer tool bug Issues that are considered to be bugs help wanted An issue where third-party help is wanted on labels May 28, 2021
@sschuberth sschuberth added the hacktoberfest An issue suitable for the Hacktoberfest label Oct 2, 2021
@mnonnenmacher
Copy link
Member

@MoumitaManna I had a deeper look into the NuGet implementation and found several issues. If you want you could try out my test implementation in the "nuget-rewrite" branch which should address most issues, however to correctly fix the issue the NuGet implementation should be rewritten. I will close this issue in favor of #5038 where I have documented my findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer About the analyzer tool bug Issues that are considered to be bugs hacktoberfest An issue suitable for the Hacktoberfest help wanted An issue where third-party help is wanted on
Projects
None yet
Development

No branches or pull requests

3 participants