LINQPad NuGet packages - Circular dependency bug?
When trying to download certain NuGet packages, it appears LINQPad tries to use version 4 of the System.Reactive package when it should be using version 3.1.
The error reads "Error downloading WebLinq 1.0.0-alpha-20170321T1506(Prerelease) - Circular dependency detected 'System.Reactive 3.1.0 => System.Reactive.PlatformServices 4.0.0-preview.2.build.379 => System.Reactive 3.1.0"
I get a similar error when I try to download System.Reactive 3.1.0 for instance.
I tried clearing my NuGet cache in %LocalAppData%\LINQPad\NuGet.FW46 but unfortunately this didn't work. The only workaround found so far has been to copy someone else's WebLinq or System.Reactive NuGet cache into my machine.
The error reads "Error downloading WebLinq 1.0.0-alpha-20170321T1506(Prerelease) - Circular dependency detected 'System.Reactive 3.1.0 => System.Reactive.PlatformServices 4.0.0-preview.2.build.379 => System.Reactive 3.1.0"
I get a similar error when I try to download System.Reactive 3.1.0 for instance.
I tried clearing my NuGet cache in %LocalAppData%\LINQPad\NuGet.FW46 but unfortunately this didn't work. The only workaround found so far has been to copy someone else's WebLinq or System.Reactive NuGet cache into my machine.
Comments
It happens with a package from our own & private nuget feed so I cannot share the package.
The circular dependency chain ends with very System.Reactive 3.1.1 => System.Reactive.PlatformServices 4.0.0 => System.Reactive 3.1.1
Same package is installing just fine in an empty project in Visual Studio. No errors are shown.
Any ideas how to overcome this issue?
(I tried cleaning up linqpad's nuget cache, didn't work.
Now none of the scripts that were using our own packages are working, all failing with same circular reference error involving Reactive package
Please send help!
Installed latest beta, same behavior
All other ways that I tried:
- Package Manager UI
- Package Manager Console
- dotnet add package
All of these do succeed and allow to add the package successfully.
The problem with System.Reactive 3.1.0 causing circular dependencies is a known issue:
https://github.com/NuGet/Home/issues/5751
"System.Reactive packages appear to have reversed dependency order between versions which is especially painful since the 3.x packages do not have an upper bound on the dependency ranges, which means that the circular combination is allowed."
"When resolving packages NuGet does not attempt to look for other solutions if a circular dependency occurs, this is considered a package authoring error and it is usually better to fail with a helpful message there instead of potentially coming up with a very unexpected set of packages to workaround the problem automatically. Here you don't own these packages, so it isn't very helpful unfortunately."
More info:
https://github.com/reactiveui/ReactiveUI/issues/1413
and on StackOverflow:
https://stackoverflow.com/questions/48878418/circular-dependency-detected-when-installing-nuget-package-akavache-6-0-0-alpha
"The resolver for packages.config and PackageReference restore styles work differently. Packages.config does the resolution only at install time and tries to resolve all dependencies! It obeys the "nearest first" rule to a tee, and if it happens that leads to a circular dependency, so be it. PackageReference is smarter in that it will try to resolve some of these conflicts and bump-up or bump down some versions"
In terms of a resolution with LINQPad, a fix would require that NuGet.exe be updated to relax the rules regarding circular dependencies. Alternatively, if you have control over the package in question, upgrading the dependency to the latest System.Reactive (4.0) would fix the problem.
We're considering at the moment upgrading System.Reactive to latest version across all of our packages. Despite the hassle (number of packages) seems to be the only solution that will work.