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

[Bug]: nuget restore fails to warn user if two project.assets.json files collide #12140

Open
ghost opened this issue Oct 6, 2022 · 5 comments
Labels
Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug

Comments

@ghost
Copy link

ghost commented Oct 6, 2022

NuGet Product Used

dotnet.exe

Product Version

dotnet sdk 6.0.401, msbuild MSBuild version 17.3.1+2badb37d1 for .NET 17.3.1.41501

Worked before?

n/a

Impact

It's more difficult to complete my work

Repro Steps & Context

A user approached me with a failing build, having trouble root causing the failure. The error messages generated misled the user into thinking it was a compile error, but investigation revealed that nuget restore malfunctioned on one of their projects. It turns out nuget restore fails to notice the file collision, so returns succcess but some projects have the incorrect project.assets.json, resulting in C# compilation errors that confuse the user.

dotnet restore should error out if restore cannot be completed correctly due to file collisions.

Repro steps

  1. check out repo https://github.com/erinlah-ms/bug-repros/tree/main/
  2. ensure dotnet sdk 6.0.401 is installed
  3. cd repro-two-proj-same-folder/oops
  4. dotnet restore /bl:restore.binlog dirs.proj
  5. dotnet build --no-restore /bl:build.binlog dirs.proj

[expected]
build error on step 4, during restore. Should report that file everything\obj\project.assets.json (project one.csproj) was overwitten or collided with the projects.assets.json file for another project (two.csproj)

[actual]
step 5 fails with a misleading error message. User is further confused because attempting to build is nondeterministic. Sometimes one.csproj fails to build with one.cs(1,12): error CS0103: The name 'Newtonsoft' does not exist in the current context. Sometimes two.csproj fails to build with two.cs(1,7): error CS0246: The type or namespace name 'Jint' could not be found

Verbose Logs

N/A, too much pii
@Nirmal4G
Copy link

Nirmal4G commented Oct 7, 2022

See #4463 (comment).

@erdembayar
Copy link
Contributor

@nkolev92
Is it duplicate of #4463?

@nkolev92
Copy link
Member

nkolev92 commented Oct 7, 2022

@nkolev92 Is it duplicate of #4463?

Yep, looks like it.

@erdembayar
Copy link
Contributor

@erinlah-ms Sorry about this. The reason I closed this issue was because we We think it's a duplicate of #4463

Please upvote in the linked issue. That helps in our triaging process.

@Nirmal4G Please check #4463 issue for more details if you're still interested.

@ghost
Copy link
Author

ghost commented Oct 7, 2022

@erdembayar @nkolev92 this is not a duplicate. I'm not requesting that shared intermediates "work". I'm asking that the error be detected and reported, instead of silently swallowed, at least until such time that it's made to work.

Or, to explain by analogy with cars, #4463 is requesting the car get an addition of a reverse gear. I'm asking for the car to not silently fall apart to pieces on the highway if the user mistakenly activates the non-existent reverse gear.

Please reactivate. Thanks.

@erdembayar erdembayar reopened this Oct 7, 2022
@nkolev92 nkolev92 added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Pipeline:Icebox labels Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug
Projects
None yet
Development

No branches or pull requests

4 participants