NuGetPackageExplorer / NuGetPackageExplorer

Create, update and deploy Nuget Packages with a GUI
MIT License
2.37k stars 444 forks source link

Duplicated files are not displayed #865

Closed ltrzesniewski closed 3 years ago

ltrzesniewski commented 4 years ago

When a faulty package contains a duplicated file, NPE doesn't show it (FodyCommon.dll in this example):

image

Type: Bug

NPE version: 5.5.23

OS version: Windows 10 - 1903

Installed from: GitHub release

What is the current result? The duplicated file is shown only once

What is the expected result? The duplicated file should be displayed twice, as in the zip

Are there any workarounds? No

Is there a version in which it did work? Probably not

Is there a package on Nuget.org which shows the bug?

https://www.nuget.org/api/v2/package/Fody/6.0.4

Reported here: https://github.com/Fody/Fody/issues/763

wreuel commented 3 years ago

@clairernovotny how could I help with this issue?

clairernovotny commented 3 years ago

Go for it. What happens when NuGet restores the package? Only one of the files could be on the disk.

ltrzesniewski commented 3 years ago

I just checked, and dotnet restore does not detect this issue (as of the SDK v5.0.201). One of the two files is written to the disk.

clairernovotny commented 3 years ago

@jondouglas should NuGet pack error out on this condition? seems like it would always lead to an ambiguous result.

JonDouglas commented 3 years ago

Pretty sure we just added an error for this last month. Let me look.

JonDouglas commented 3 years ago

https://github.com/NuGet/NuGet.Client/pull/3923

jzabroski commented 3 years ago

@JonDouglas Thank you! Is it deployed yet. I dont get an error when I run dotnet.exe pack with a scenario that causes this.

@clairernovotny I will say, I do think the basic premise of a NugetPackageExplorer should be that it handle bad zip files with duplicate contents, since the whole point is to see how the zip file is laid out in Nuget-land.

jzabroski commented 3 years ago

Note, it also looks like this problem can occur as a result of https://github.com/NuGet/Home/issues/3584

jzabroski commented 3 years ago

@JonDouglas I looked at the warning in https://github.com/NuGet/NuGet.Client/pull/3923 and its not exactly optimal, since it tells you sort of what we already know - that there is a duplicate inside the package. Would be nicer if dotnet.exe pack warns you as its about to add the duplicate what the provenance of both the duplicate and original file was.

I'll guess I'll try MSBuild Bin Log viewer tool from Kirill Osenkov.

jzabroski commented 3 years ago

Actually, I don't understand how this duplicate detection logic works.

jzabroski commented 3 years ago

It also looks like there is no way to disable this logic.

I think the problem is that the order in which duplicates is removed from PackageFiles is incorrect, and so there are scenarios in which it is impossible to remove a PackageFiles value from the Pack Task. This is something I (believe I) noticed a few weeks ago when trying Nugetizer for the first time.

jzabroski commented 3 years ago

I figured it out - the duplicate detection occurs even when the nuspec file itself contains overlapping entries. I was assuming the duplicate came from MSBuild csproj being packed, rather than the nuspec file.

clairernovotny commented 3 years ago

Closing as by design then.