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

Restore trying the wrong source, and failing if that is unavailable #13950

Open
MrYossu opened this issue Nov 20, 2024 · 2 comments
Open

Restore trying the wrong source, and failing if that is unavailable #13950

MrYossu opened this issue Nov 20, 2024 · 2 comments
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver Type:Bug WaitingForCustomer Applied when a NuGet triage person needs more info from the OP

Comments

@MrYossu
Copy link

MrYossu commented Nov 20, 2024

NuGet Product Used

dotnet.exe

Product Version

9.0.100

Worked before?

Version 8, not sure exactly which

Impact

I'm unable to use this version

Repro Steps & Context

I have a GitHub repo that generates various Nuget packages, one of which uses Telerik components for Blazor.

The nuget.config file for the repo can be seen here, and the YAML file for the master branch can be seen here.

I have built this repo (and consequently published the packages) many times, and have never had problems (other than my own of course!). However, I pushed some changes today, and the build failed.

For every package referenced in the repo, I get lines like the following...

D:\a\Pixata.Utilities\Pixata.Utilities\Pixata.Blazor\Pixata.Blazor.csproj : error NU1301: Failed to retrieve information about 'Microsoft.AspNetCore.Components' from remote source 'https://nuget.telerik.com/nuget/FindPackagesById()?id='Microsoft.AspNetCore.Components'&semVerLevel=2.0.0'.
D:\a\Pixata.Utilities\Pixata.Utilities\Pixata.Blazor\Pixata.Blazor.csproj : error NU1301: Response status code does not indicate success: 503 (Service Unavailable).

Notice that the package in question is not a Telerik one, so I have no idea why it's looking on the Telerik feed. Also, the Telerik feed is the second one in the nuget.config file, so I would have expected it to check the nuget feed first. Furthermore, if I open the package manager in Visual Studio and look for packages on the Telerik feed, it finds them fine, which implies that the feed is working fine.

I tried commenting out the line in nuget.config that references the Telerik feed, but that failed...

D:\a\Pixata.Utilities\Pixata.Utilities\Pixata.Blazor.TelerikComponents\Pixata.Blazor.TelerikComponents.csproj : error NU1101: Unable to find package Telerik.UI.for.Blazor. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, NuGet
Failed to restore D:\a\Pixata.Utilities\Pixata.Utilities\Pixata.Blazor.TelerikComponents\Pixata.Blazor.TelerikComponents.csproj (in 9.21 sec).

I tried adding `` --ignore-failed-sourcesto eachdotnet restore` line in the `.yaml` file, but that didn't help. The build failed with the same results. Didn't try the nuget feed after the Telerik one failed.

Anyone able to advise? I need to publish a new version of a package, but can't.

Please let me know if there is any more info I can add.

Thanks

Verbose Logs

No response

@MrYossu
Copy link
Author

MrYossu commented Nov 21, 2024

Hmm, I fixed the problem, but have no idea how it ever worked before!

The package sources in my nuget.config file have looked like this ever since I created the file...

  <packageSources>
    <clear />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
    <add key="TelerikFeed" value="https://nuget.telerik.com/nuget" />
  </packageSources>

I just changed the value of the Telerik feed to https://nuget.telerik.com/v3/index.json, and the build worked fine.

Whilst it makes sense that I'd need a full URL in there (the previous one was missing the file at the end), what I don't understand is how this has always worked before, why it suddenly started looking at the Telerik feed for non-Telerik packages, why it didn't check the Nuget feed first (given that it was specified first in the config file) and why it didn't check that after the Telerik one failed.

Anyone able to explain? Thanks

@martinrrm
Copy link
Contributor

Hi! It's great that you found a solution, did this problem started after updating to .NET 9? If so, it could be related to a change we did for that version. This is because the new NuGet dependency resolution algorithm downloads packages in parallel as an optimization and can in some cases download extra packages that were previously eclipsed during a graph walk.

So, I believe since this package is available in nuget.org, and you don't have a configurated Package Source Mapping, the package was getting downloaded from nuget.org

@martinrrm martinrrm added Area:NewDependencyResolver Issues related to the new dependency graph resolver WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed Triage:Untriaged labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver 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