NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Improve error messages on malformed service indexes #6692

Open loic-sharma opened 6 years ago

loic-sharma commented 6 years ago

If the service index is missing a link to the registration service, NuGet will spit out the following error message on the dotnet CLI:

Microsoft (R) Build Engine version 15.6.82.30579 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for D:\Code\Test\Test.csproj...
C:\Program Files\dotnet\sdk\2.1.100\NuGet.targets(104,5): error : Value cannot be null. [D:\Code\Test\Test.csproj]
C:\Program Files\dotnet\sdk\2.1.100\NuGet.targets(104,5): error : Parameter name: baseUrl [D:\Code\Test\Test.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\2.1.100\NuGet.targets(104,5): error : Value cannot be null. [D:\Code\Test\Test.csproj]
C:\Program Files\dotnet\sdk\2.1.100\NuGet.targets(104,5): error : Parameter name: baseUrl [D:\Code\Test\Test.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.50

This error message is generated by an exception thrown by RegistrationResourceV3's constructor if the RegistrationResourceV3Provider cannot find a registration hive from the service index. My suggestions:

  1. The dotnet CLI should give a full stack trace for NuGet exceptions to ease debugging
  2. The error message should be improved. For example:

Cannot find registration base address from package source "..."

ghost commented 1 year ago

Due to lack of recent activity, this issue has been marked as a candidate for icebox cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will add a Triage:NeedsTriageDiscussion label and lead to a triaging process. This process is part of the experimental Stale icebox issues cleanup we are currently trialing. Please share any feedback you might have in the linked issue.

loic-sharma commented 1 year ago

Bad bot. This scenario is not uncommon, especially when custom package repositories like Azure DevOps / GitHub Artifacts have an error.