Repository navigation
dotnet nuget why reports requested as well as resolved versions - #7344
Conversation
There was a problem hiding this comment.
Fascinating that WhyCommand_FileBasedApp is failing now. The test creates a package with casing 'packageA, then references it with casing 'PackageA', then expects the output to contain the referenced casing 'PackageA rather than the package's actual casing. If a user had <PackageReference Include="newtonsoft.jsoN" />, what casing should we expect to see in the output of dotnet nuget why? Probably the casing of the actual package? So your refactoring fixed something we didn't even know to look for...?
|
All of our installation codepaths when asked to install a package should be adding the true casing of the package installed at the end. NuGet/Home#5952 was something we fixed. NuGet/Home#5951 is PMC and needs fixed. |
|
Is 7c1b46a due to 10.0.400 being to late now? It wasn't deemed a breaking change so I'd thought it could end up in .NET 10? (Seems like the chance for a backport is low if the code only is for >= .NET 11 anyways) Noticed the updated description now (Usually good with a comment so those changes are easier to find)
What was the rationale for that? |
|
No, we still have time to get changes into 10.0.400, otherwise I wouldn't have needed the extra code. The issue is that some peoples' impression of past discussions is that all changes to output are breaking changes. This is also what the sdk repo's docs effectively imply: https://github.com/dotnet/sdk/blob/9a363f2d88a8e7226f77cb6b8e0ff1fa4a8f2513/documentation/project-docs/breaking-change-guidelines.md?plain=1#L28 But I was still given feedback that they'd like to see it in .NET 11 only, and I'd rather move on to other work than continuing the discussion and trying to get everyone in agreement. I'm hoping that the sdk team will update the guidelines to make it clearer that unstructured text changes is acceptable in feature bands, not just major versions. Then future changes will be easier.
Yes, I hope most people in Microsoft working on .NET is aware of this. I completely understand wanting to ship apps that use LTS versions of the runtime. But, I struggle a bit to understand why people also do the same with build tools (the .NET SDK). Teams writing native code and wanting to support CPUs from 2005 don't need to limit themselves to compilers written in 2005. Modern compilers can output code that works on CPUs without modern instructions. Or supporting old versions of Android or iOS doesn't limit you to build tools from when those old versions shipped. Similarly, The .NET 11 SDK will be able to build apps targeting net10.0. In defense of the people who think this pull request should take effect in .NET 11 and not .NET 10.0.400, Fedora and Ubuntu (and any other Linux distro that uses .NET's "source build" version of .NET, rather than Microsoft's binaries) will only get 10.0.1xx. If developers switch between 10.0.1xx and 10.0.4xx as part of their daily work (say, CI machines are linux, local machine is windows or mac), then perhaps it could be a bit jarring when commands have different behaviors. So, there's definately a compelling argument that not all changes should be made in feature bands. Although this argument wasn't made during the internal discussions this week 🤷 I just want to move on. Coding is fun, resolving disagreements is not 😆 |
Thanks for the explanation, the transparency is much appreciated and maybe the community could further provide their views if we know the rationale behind these types of decisions. (Any specific Issue or PR I should track for the potential 10.0.400 inclusion?) I think some portion of people wanting to stick to the same SDK version as their TFM is that the docs aren't so clear about the fact that newer SDKs can build older TFMs and the guarantees of the runtime about breaking changes for that built code when it's built with a new major version of the SDK. Not every developer understands SDK vs Runtime(and TFM) in my experience (I try my best to explain at every turn). (A new version of the SDK carries newer versions of the compiler so some people I think worry about the code being generated since the guarantees aren't that obvious) Keep on coding 😆! |
Pull requests on the dotnet VMR for nuget/nuget.client. We recently made some infrastructure changes which seems to broken code flow, but we're trying to figure it out. |
Bug
Fixes: NuGet/Home#13752
Fixes: NuGet/Home#14695
Description
Shows the requested and resolved versions for each package. Removes the version for project references, making it more obvious that the graph node is indeed a project. Here's a sample:
It was decided that this output should only take effect in .NET 11, so .NET 10.0.400 will still continue to show the old format.
The above feature modified the same lines needed to fix running why on a legacy csproj, so both are being fixed in the same pull request, rather than two PRs that would need to be opened sequentially.
I used copilot to implement showing the requested version, but when reviewing its changes to DependencyGraphFinder.cs, I found the file's algorithm confusing. So, I commit copilot's changes unreviewed, then rewrote the class from scratch, with a few small changes in other files. Overall, it reduces product code by about 100 lines. If my rewrite isn't liked, we can revert the refactor commit from the branch, but then if someone has questions about the changes to DependencyGraphFinder, I may not be able to answer it.
The algorithm of the new class is, for each target in the assets file, create an in-memory
LockFileTargetLibrarywith the project's direct package and project references as dependencies, then recursively convert aLockFileTargetLibraryinto aDependencyNode. It does this with no intermediate state, other than the "fake"LockFileTargetLibraryfor the project's root. The tree is filtered for the package requested on thedotnet package whycommand line, but the way it's written, it will be trivial (change one if statement) to either show the complete unfiltered tree, or filter on multiple packages, or a partial package id match.The implementation has a performance optimization, so it doesn't create the tree/graph and then filter as a second step. Instead, it returns nulls when the package is filtered out and there are no children. Dependencies that return null are removed, so when no dependency has the package, the node looks like it has no dependencies and so also gets removed if the package name also doesn't match. So, entire subtrees that don't contain the searched requested package avoid being created, with minimal (hopefully zero) memory allocations.
In order to have stronger guarantees on nullability, I modified
DependencyNodeto be an abstract class soPackageNodes must have both a requested version and resolved version.The refactor found some tests that use an invalid assets file. I deleted these tests as the multi-rid nature of the tests are very difficult to replicate, but mostly test scenarios that theoretically possible, but not really practical. I'll comment on the two assets files explaining which each is infeasible, as justification why to delete the test rather than spending a lot of effort to fix it.
PR Checklist