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

[Bug]: Package downgrade and error messages #10126

Open
marcin-krystianc opened this issue Oct 15, 2020 · 2 comments
Open

[Bug]: Package downgrade and error messages #10126

marcin-krystianc opened this issue Oct 15, 2020 · 2 comments
Assignees
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Area:RestoreCPM Central package management Area:RestoreCPMTransitiveDependencies Functionality:Restore Priority:2 Issues for the current backlog. Type:Bug

Comments

@marcin-krystianc
Copy link

Hi, we've discovered recently that NuGet has native support for central package versioning CPVM. It is definitely a good step forward to simplify version management for large solutions, but it seems that there are some significant changes in how the restore errors are being reported.

Test solution

Let's assume that we have simple application with two library projects (SimpleAppWithLibs-Centralised.zip), e.g.:

App -> Lib1 -> Newtonsoft.Json (>= 9.0.1)
    -> Lib2 -> Newtonsoft.Json.Bson (>= 1.0.2) -> Newtonsoft.Json (>= 12.0.1)

Problem

When we try to run dotnet restore for such solution then we get following error messages:

error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version.  [...\Solution.sln]
error NU1109:  App -> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1)  [...\Solution.sln]
error NU1109:  App -> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version.  [...\Solution.sln]
error NU1109:  Lib2 -> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1)  [...\Solution.sln]
error NU1109:  Lib2 -> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
  Failed to restore ...\Lib2\Lib2.csproj (in 300 ms).
  Restored ...\Lib1\Lib1.csproj (in 299 ms).
  Failed to restore ...\App\App.csproj (in 300 ms).

I appreciate the fact that by design restore operation works differently for CPVM enabled solutions compared to the non-CPVM case. My concern is that error reporting also works very differently, so for example error messages from above are repeated for each failed project. For large solutions containing hundreds of projects this can become very noisy.

Another issue is that one of the error messages suggests that App project has references to the Newtonsoft.Json and to the Newtonsoft.Json.Bson where actually it doesn't have any of these references. It is not clear from the error message that these are transitive references from Lib1 and Lib2.

Can you please confirm whether this is desired error reporting behaviour for CPVM enabled solutions?

Version

  • dotnet.exe --version : 5.0.100-rc.2.20479.15
@rconard rconard self-assigned this Oct 15, 2020
@rconard
Copy link

rconard commented Oct 15, 2020

@marcin-krystianc, thank you for sharing your feedback on CPVM's restore and pack.

Your issue is closely related to #10115. Could you take a look at that issue?

We would appreciate your giving feedback on that issue. If you are okay, I will merge these issues.

@marcin-krystianc
Copy link
Author

@rconard I see how these two issues are related but I think it is better to keep them separate.
My concern in this issue is only about how the version downgrade errors are being reported when the "transitive pinning" behaviour is enabled (regardless of whether it is the default or opt-in behaviour).

As I said in the previous comment, there are two problems with these error messages:

  • It is going to be a lot of repetition in error messages (especially for large solutions), but maybe that is unavoidable.
  • There is no distinction between direct references and transitive reference in the error message. Therefore I think that the error message can be confusing.

Maybe the transitive reference type can be marked with different type of arrow e.g. : ~> ? So the example from previous comment would look like this:

error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version.  [...\Solution.sln]
error NU1109:  App ~> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1)  [...\Solution.sln]
error NU1109:  App ~> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version.  [...\Solution.sln]
error NU1109:  Lib2 -> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1)  [...\Solution.sln]
error NU1109:  Lib2 ~> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
  Failed to restore ...\Lib2\Lib2.csproj (in 300 ms).
  Restored ...\Lib1\Lib1.csproj (in 299 ms).
  Failed to restore ...\App\App.csproj (in 300 ms).

@nkolev92 nkolev92 added Area:ErrorHandling warnings and errors/log messages & related error codes. Area:Logging Functionality:Restore Priority:2 Issues for the current backlog. and removed Area:Logging labels Oct 26, 2020
@jeffkl jeffkl changed the title [CPVM] Package downgrade and error messages [Bug]: Package downgrade and error messages Apr 15, 2022
@jeffkl jeffkl self-assigned this May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Area:RestoreCPM Central package management Area:RestoreCPMTransitiveDependencies Functionality:Restore Priority:2 Issues for the current backlog. Type:Bug
Projects
None yet
Development

No branches or pull requests

6 participants