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

Flaky restore, NU1107 version conflict #14020

Open
304NotModified opened this issue Dec 24, 2024 · 3 comments
Open

Flaky restore, NU1107 version conflict #14020

304NotModified opened this issue Dec 24, 2024 · 3 comments
Labels
Functionality:Restore Type:Bug WaitingForCustomer Applied when a NuGet triage person needs more info from the OP

Comments

@304NotModified
Copy link

304NotModified commented Dec 24, 2024

NuGet Product Used

dotnet.exe

Product Version

.NET 8.0.404 & Nuget 6.12.1.1

Worked before?

yes, not sure which version

Impact

It's more difficult to complete my work

Repro Steps & Context

If I run dotnet.exe restore mySolution.sln --configfile someconfig.config --verbosity minimal

It works most of the times (~80%), and sometimes gives NU1107 (with the same code, commit, versions etc)

This is on Azure DevOps pipelines (Windows 2022), but also sometimes in VS 2022 (Windows 11)

I get this error:

C:\Data\Agent\_work\2005\s\Backend\MyProject\MyProject.csproj : error NU1107: Version conflict detected for Microsoft.Extensions.DependencyInjection.Abstractions. Install/reference Microsoft.Extensions.DependencyInjection.Abstractions 8.0.0 directly to project MyProject to resolve this issue.  [C:\Data\Agent\_work\2005\s\mySolution.sln]
C:\Data\Agent\_work\2005\s\Backend\MyProject\MyProject.csproj : error NU1107:  MyProject -> Microsoft.Extensions.Options.DataAnnotations 8.0.0 -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)  [C:\Data\Agent\_work\2005\s\mySolution.sln]
C:\Data\Agent\_work\2005\s\Backend\MyProject\MyProject.csproj : error NU1107:  MyProject -> Microsoft.Extensions.DependencyInjection 8.0.1 -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2). [C:\Data\Agent\_work\2005\s\mySolution.sln]
  Failed to restore C:\Data\Agent\_work\2005\s\Backend\MyProject\MyProject.csproj (in 222 ms)

I don't get it:

  • Why isn't Microsoft.Extensions.DependencyInjection.Abstractions 8.0.2 selected?
  • Why does this work most of the time (same commit, same .NET version, same nuget.exe version)

If it does work, it will use 8.0.2 (as expected) - visible with dotnet list mySolution.sln package)

Part of output:

   [net8.0]: 
   Top-level Package                                            Requested   Resolved
   > Microsoft.ApplicationInsights                              2.*         2.22.0  
   > Microsoft.Extensions.Configuration.Abstractions            8.*         8.0.0   
   > Microsoft.Extensions.Configuration.Binder                  8.*         8.0.2   
   > Microsoft.Extensions.DependencyInjection.Abstractions      8.*         8.0.2   
   > Microsoft.Extensions.Http                                  8.*         8.0.1   
   > Microsoft.Extensions.Logging.Abstractions                  8.*         8.0.2   

Verbose Logs

No response

@304NotModified
Copy link
Author

Is this the same as #13888?

@304NotModified
Copy link
Author

304NotModified commented Dec 25, 2024

Or maybe #13992

@zivkan
Copy link
Member

zivkan commented Dec 29, 2024

I tried creating this sample, with a script that loops and restores 100 times, trying to find a restore error:
gh14020.zip

However, when I run the script, it completes all 100 iterations without any errors. Are you able to reproduce the error this way?

Please make sure to replace the list of sources in the sample NuGet.Config file with the sources from your repo that is having problems. Don't replace the entire NuGet.Config file though, as I included a config change to redirect the global packages folder to the obj/ directory, rather than using the default location.

If it doesn't reproduce, try adding a dotnet nuget locals http-cache -c next to the git clean line, and try again.

If you can reproduce the error, please backup the obj/ directory, restore again when an error does not happen, and then diff all the files in the two directories.

I'm not sure what NuGet writes to the obj/project.assets.json file. If it provides a list of packages that were restored successfully, it will be interesting to see if any of the packages have different dependencies between the two restores.

Is this the same as #13888?

No, that will cause an error on every restore when the bug is triggered. It won't be intermittant.

Or maybe #13992

No, the new dependency resolver was added in the .NET 9.0.100 SDK, and you wrote that you're using the 8.0.400 SDK. So, assuming you're correct about which SDK is being used in the restore, then it's not possible. VS 17.12 includes the new dependency resolver, but this wouldn't explain why you say you're getting this with the .NET 8.0.400 SDK.

@zivkan zivkan added Functionality:Restore WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed Triage:Untriaged labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Type:Bug WaitingForCustomer Applied when a NuGet triage person needs more info from the OP
Projects
None yet
Development

No branches or pull requests

2 participants