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

Nuget Incorrectly Reporting "Unable to find a stable package" #13399

Open
jledgett opened this issue Apr 18, 2024 · 5 comments
Open

Nuget Incorrectly Reporting "Unable to find a stable package" #13399

jledgett opened this issue Apr 18, 2024 · 5 comments
Labels
Type:Bug WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually.

Comments

@jledgett
Copy link

NuGet Product Used

Visual Studio Package Manager Console

Product Version

dotnet restore

Worked before?

Yes, whatever build was available in early March.

Impact

I'm unable to use this version

Repro Steps & Context

  • On macOS x64:
    • Install .NET 8.0.204 SDK (8.0.4 Runtime)
    • run dotnet --list-runtimes to verify install of runtime:
      • Microsoft.AspNetCore.App 8.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
      • Microsoft.NETCore.App 8.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
    • run dotnet --list-sdks to verify install of SDKs:
      • 8.0.204 [/usr/local/share/dotnet/sdk]

For a project with the following in the CSPROJ, dotnet restore works fine:

	<ItemGroup>
		<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.3"/>
		<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0"/>
		<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
		<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0"/>
		<PackageReference Include="PagedList.Core.Mvc" Version="3.0.0"/>
		<PackageReference Include="PagedList.Core" Version="1.17.4"/>
		<PackageReference Include="SendGrid" Version="9.29.2"/>
	</ItemGroup>

Changing references to...

	<ItemGroup>
		<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4"/>
		<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0"/>
		<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
		<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0"/>
		<PackageReference Include="PagedList.Core.Mvc" Version="3.0.0"/>
		<PackageReference Include="PagedList.Core" Version="1.17.4"/>
		<PackageReference Include="SendGrid" Version="9.29.3"/>
	</ItemGroup>

and running dotnet restore causes these errors to be raised (path removed):

Determining projects to restore...
error NU1103: Unable to find a stable package Microsoft.AspNetCore.Mvc.NewtonsoftJson with version (>= 8.0.4)
error NU1103: - Found 154 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24081.5 ]
error NU1102: Unable to find package SendGrid with version (>= 9.29.3)
error NU1102: - Found 117 version(s) in nuget.org [ Nearest version: 9.29.2 ]
Failed to restore (in 1.34 sec).


Running dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 8.0.4

Determining projects to restore...
Writing /var/folders/ht/bnz7h_6d1jb01dg6y7kjltxm0000gn/T/tmpWugafd.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/local/share/dotnet/sdk/8.0.204/trustedroots/codesignctl.pem'.
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/local/share/dotnet/sdk/8.0.204/trustedroots/timestampctl.pem'.
info : Adding PackageReference for package 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' into project '/Volumes/Data/Websites/Staging/vintagejeeps.net/live/Framework.csproj'.
info : Restoring packages for ...
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.newtonsoftjson/index.json
info : GET https://api.nuget.org/v3-flatcontainer/sendgrid/index.json
info : OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.newtonsoftjson/index.json 262ms
info : OK https://api.nuget.org/v3-flatcontainer/sendgrid/index.json 306ms
error: NU1103: Unable to find a stable package Microsoft.AspNetCore.Mvc.NewtonsoftJson with version (>= 8.0.4)
error: - Found 154 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24081.5 ]
error: NU1102: Unable to find package SendGrid with version (>= 9.29.3)
error: - Found 117 version(s) in nuget.org [ Nearest version: 9.29.2 ]
info : GET https://api.nuget.org/v3/vulnerabilities/index.json
info : OK https://api.nuget.org/v3/vulnerabilities/index.json 23ms
info : GET https://api.nuget.org/v3-vulnerabilities/2024.03.23.05.37.04/vulnerability.base.json
info : GET https://api.nuget.org/v3-vulnerabilities/2024.03.23.05.37.04/2024.03.24.11.37.12/vulnerability.update.json
info : OK https://api.nuget.org/v3-vulnerabilities/2024.03.23.05.37.04/vulnerability.base.json 22ms
info : OK https://api.nuget.org/v3-vulnerabilities/2024.03.23.05.37.04/2024.03.24.11.37.12/vulnerability.update.json 22ms
error: Package 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' is incompatible with 'all' frameworks in project


Tried running nuget locals all -clear to no effect...

Verbose Logs

No response

@jebriede
Copy link
Contributor

Thanks for reporting this. I tried reproducing the issue with the same version of .NET SDK 8.0.204 and when adding either Microsoft.AspNetCore.Mvc.NewtonsoftJson version 8.0.4 or SendGrid 9.29.3 to a project, the issue did not reproduce for me.

I want to better understand if there's something particular about the project that is the issue or if this is reproducing with a new project for you as well. Could you try creating a new Console App and for that project, running:
dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 8.0.4

And let us know if that succeeds?

@jebriede jebriede added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed Triage:Untriaged labels Apr 20, 2024
@jledgett
Copy link
Author

jledgett commented Apr 20, 2024

@jebriede

edgett@imac ~ % cd /Volumes/Data/Websites/Staging
edgett@imac Staging % mkdir test
edgett@imac Staging % cd test
edgett@imac test % dotnet new console --framework net8.0 --use-program-main
The template "Console App" was created successfully.

Processing post-creation actions...
Restoring /Volumes/Data/Websites/Staging/test/test.csproj:
  Determining projects to restore...
  Restored /Volumes/Data/Websites/Staging/test/test.csproj (in 114 ms).
Restore succeeded.


edgett@imac test % dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 8.0.4
  Determining projects to restore...
  Writing /var/folders/ht/bnz7h_6d1jb01dg6y7kjltxm0000gn/T/tmpB0czL0.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/local/share/dotnet/sdk/8.0.204/trustedroots/codesignctl.pem'.
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/local/share/dotnet/sdk/8.0.204/trustedroots/timestampctl.pem'.
info : Adding PackageReference for package 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' into project '/Volumes/Data/Websites/Staging/test/test.csproj'.
info : Restoring packages for /Volumes/Data/Websites/Staging/test/test.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.newtonsoftjson/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.newtonsoftjson/index.json 82ms
error: NU1103: Unable to find a stable package Microsoft.AspNetCore.Mvc.NewtonsoftJson with version (>= 8.0.4)
error:   - Found 154 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24081.5 ]
error: Package 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' is incompatible with 'all' frameworks in project '/Volumes/Data/Websites/Staging/test/test.csproj'.

@dotnet-policy-service dotnet-policy-service bot added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Apr 20, 2024
@jledgett
Copy link
Author

jledgett commented Apr 24, 2024

@jebriede

Additional Update

I ran the following

sudo nuget update --self

This indicated that I was running a 5.x version of Nuget (I forgot to note which exact version and accidentally exited the terminal), and 6.9.1.3 was available.

I then executed:

nuget locals all -clear
dotnet restore

Now the restore succeeded and the packages installed correctly.

So, the following questions remain:

  • What changed in the latest .NET 8.x update that made the prior working NuGet install stop working.
  • More importantly, as I am running the most recent release of both VS Code and .NET, why wouldn't NuGet be automatically updated?

@jgonz120
Copy link

.NET ships a version of the NuGet CLI but you would access it using dotnet nuget. You need to download and update the standalone CLI separately.

There must be something between the 5.x and 6.9.x versions of NuGet that prevented the nuget locals all -clear command from fixing the issue.

Are there any additional details you can provide about your setup that could help us get a repro?

@dotnet-policy-service dotnet-policy-service bot added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Apr 24, 2024
@jledgett
Copy link
Author

Older Intel-based iMac with 32GB RAM, running macOS Catalina 10.15.7 (waiting for the next update to the Mac Studio to get off this ancient but serviceable machine).

I have VS Code 1.88.1 and the aforementioned versions of .NET.

I may have had Visual Studio for Mac at some point, perhaps that is where the version of Nuget came from, because I wouldn’t have went out of my way to install a standalone client.

@dotnet-policy-service dotnet-policy-service bot added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Bug WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually.
Projects
None yet
Development

No branches or pull requests

3 participants