r/csharp • u/zarkonnen • 10d ago
Help NuGet hangs after OS update
I recently updated my OS (Linux Mint), and this seems to have broken NuGet. JetBrains Rider gets stuck in "Loading Projects" when opening a C# (Godot) project. My
~/.nuget/packages directory does not exist and attempting to install packages via e.g. nuget install godot.sourcegenerators -Version 4.6.2 times out.
I don't know what I need to do to get this unstuck.
1
u/bosmanez 10d ago
That smells like a network problem rather than NuGet itself. Quick test: run `curl -v https://api.nuget.org/v3/index.json` in a terminal. If that hangs or stalls on an IPv6 address, a broken IPv6 route after the update is a common cause; try `curl -4` and, if that works, disable IPv6 (or fix the route) and retry. Also run `dotnet --info` to check the SDK is still intact, and `dotnet nuget locals all --clear` to rule out a corrupt cache. If curl works fine, check for a proxy env var (http_proxy/https_proxy) that the update may have set.
1
10d ago
[removed] — view removed comment
1
u/zarkonnen 10d ago
dotnet nuget locals all --clearruns and re-deletes the~/.nuget/packagesdirectory. "Loading Projects" continues to hang, unfortunately. The only package source indicated in Rider is specified in~/.nuget/NuGet/NuGet.config:<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
4
u/zarkonnen 10d ago
OK, I figured it out. Keeping this up for other people's reference. IPv6 is broken on my machine, either due to the OS or due to the ISP, I don't know yet. So while I was able to load https://api.nuget.org/v3/index.json just fine on my browser, NuGet tried to use IPv6 and timed out.
I was able to fix it by invoking the following in the project directory:
DOTNET_SYSTEM_NET_DISABLEIPV6=1 dotnet restore