[Bug]: nuget restore fails to warn user if two project.assets.json files collide #12140
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
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
[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 withtwo.cs(1,7): error CS0246: The type or namespace name 'Jint' could not be found
Verbose Logs
The text was updated successfully, but these errors were encountered: