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

[Draft] Spec for Package Source Mapping Actions in PM UI #12616

Closed
wants to merge 1 commit into from

Conversation

donnie-msft
Copy link
Contributor

@donnie-msft donnie-msft commented May 26, 2023

This Draft PR has been replaced by PR # 12810

[Draft] Package Source Mapping Package Management Actions in the PM UI (shortcut to rendered spec)

Spec for: Issue # 11366

  • Marked Draft as there are questions about how we should proceed
  • Various edge cases are unclear

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this write up. I'm not sure I follow how NuGet/NuGet.Client#5238 is a consequence of this proposal.


The customer could also try to update a package that is already mapped to a different source, but the source it is mapped to does not support the version they are trying to update to. In these scenarios, `Restore` will fail in the same way it does today. The customer can see why `Restore` failed in the output window.

Currently, `NU1100` is used for both an incompatible TFM, and for a missing Package Source Mapping.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I mentioned in the issue, but NU1100 is always a missing package.

Missing package for source mapping vs not shouldn't matter. This was a deliberate decision at that point.

Ofc it can be a subject to change, but I think this particular statement is not correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's missing, but the suggestion was to be more specific that it's missing because package source mapping didn't allow restore to retrieve it.

Here, the NU1100 is shown only because I deleted the mapping for the package I tried to install:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So NU1100 says, PackageSourceMapping is enabled, the following source(s) were not considered: X, Y.

How would you make that clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposal was for me to create something distinct. Copying from the Desired behavior in #12606:

Specific messages for either scenario.
Specify whether the TFM not compatible, or is the PackageSourceMapping not configured?

Copy link
Member

@nkolev92 nkolev92 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that we already have different text for source mapping vs no source mapping scenarios. Are you proposing a new error code? This was something we considered and specifically opted against since when a package is not resolved, the issue could be, package doesn't exist, package exists but version doesn't, no suitable version can be selected etc. All of those get the same "due to source mapping, these sources were not considered". You can look at that in https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Commands/RestoreCommand/Diagnostics/UnresolvedMessages.cs by searching for isPackageSourceMappingEnabled .
PR regarding this NuGet/NuGet.Client#4374.

For the 2nd line, compatibility has different warning/error codes, NU1100s vs NU1200s. In fact they are generated at different points, since in the first case there is no package, but in the 2nd case, there's a package that was analyzed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, when Svetlana and I were walking through the changes to PM UI, I'm sure we both saw a case where the package was available on a source, but we got a NU1100. I'll have to see if I can recreate that.

According to the docs, TargetFramework is called out as well:

Unable to resolve 'Dependency (>= 1.0.0)' for 'TargetFramework'

https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1100

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, TargetFramework is called out as well:

It's calling that out not because it is a compatibility problem, but because projects can multi target.

proposed/2023/package-source-mapping-actions-PMUI.md Outdated Show resolved Hide resolved

1. Currently, if an `Install`/`Update` cannot find transitive packages on the mapped source being mapped, the restore will fail. Reaching out to other configured sources and allowing the customer to select a different source for these packages may resolve this issue. However, care must be taken to avoid unintentionally leaking requested package IDs to these secondary sources when the customer hasn't agreed to such a query.

1. If a package is found in the Global Packages Folder (GPF), the PM UI could look at the source in the `nupkg.metadata` file. A new mapping could either be created for this source auotmatically, or it could be presented to the customer in the Preview Window or another affordance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An idea would be:

  • Use the mapping from the GPF if the source exists.
  • Warning if the source doesn't.

I think https://github.com/NuGet/Client.Engineering/issues/1166 getting implemented will complement this nicely.

proposed/2023/package-source-mapping-actions-PMUI.md Outdated Show resolved Hide resolved
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-specSourceMappingActionSpec branch 2 times, most recently from 4f9703b to a79bebd Compare June 19, 2023 21:21
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-specSourceMappingActionSpec branch from 2ad6dfc to 0bb97aa Compare June 30, 2023 20:47
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-specSourceMappingActionSpec branch from ae7f1b8 to ac99cf4 Compare August 11, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants