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

Extra package dependencies appearing for current framework. #52318

Closed
ericstj opened this issue May 5, 2021 · 12 comments
Closed

Extra package dependencies appearing for current framework. #52318

ericstj opened this issue May 5, 2021 · 12 comments
Labels
area-Infrastructure-libraries needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity
Milestone

Comments

@ericstj
Copy link
Member

ericstj commented May 5, 2021

Description

We try to avoid dependencies on packages when that same assembly is inbox in a framework.

Take System.Text.Json for example:
https://www.nuget.org/packages/System.Text.Json/5.0.2
image
https://www.nuget.org/packages/System.Text.Json/4.7.0
image
https://www.nuget.org/packages/Microsoft.Extensions.Primitives/5.0.1
image

In PKGProj this is accomplished with https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Build.Tasks.Packaging/src/CreateTrimDependencyGroups.cs

Right now in 6.0 this is broken due to the packageIndex.json missing inboxOn entries for 6.0.

We should also decide how we handle this once we move to csproj. It's really only interesting any more for the current .NET version as that's the only place where we have package/framework duality with exact match with an inbox library. Coincidentally, this will happen automatically as a side-effect of our$(NetCoreAppCurrent) configurations in the projects, even when excluded from the package, since we cannot filter the project.assets.json that nuget's Pack task sees. So long as we ensure not to include ProjectReferences for inbox assemblies, we'll see an empty dependency group. Take Microsoft.Extensions.Primitives as an example (built with changes from #52084): https://gist.github.com/ericstj/624ab958327a1eb5ca2cc76c10c4a836#file-microsoft-extensions-primitives-nuspec-L29

So we should fix the index to include 6.0 versions so that anything that's still built using pkgproj has the expected behavior as in past releases.

We should also be more intentional about preserving this behavior in libraries which move to CSProj. I believe we've discussed having validation for this @Anipik, here's a good use case.

cc @eerhardt

@dotnet-issue-labeler dotnet-issue-labeler bot added area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner labels May 5, 2021
@ghost
Copy link

ghost commented May 5, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

We try to avoid dependencies on packages when that same assembly is inbox in a framework.

Take System.Text.Json for example:
https://www.nuget.org/packages/System.Text.Json/5.0.2
image
https://www.nuget.org/packages/System.Text.Json/4.7.0
image
https://www.nuget.org/packages/Microsoft.Extensions.Primitives/5.0.1
image

In PKGProj this is accomplished with https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Build.Tasks.Packaging/src/CreateTrimDependencyGroups.cs

Right now in 6.0 this is broken due to the packageIndex.json missing inboxOn entries for 6.0.

We should also decide how we handle this once we move to csproj. It's really only interesting any more for the current .NET version as that's the only place where we have package/framework duality with exact match with an inbox library. Coincidentally, this will happen automatically as a side-effect of our$(NetCoreAppCurrent) configurations in the projects, even when excluded from the package, since we cannot filter the project.assets.json that nuget's Pack task sees. So long as we ensure not to include ProjectReferences for inbox assemblies, we'll see an empty dependency group. Take Microsoft.Extensions.Primitives as an example (built with changes from #52084): https://gist.github.com/ericstj/624ab958327a1eb5ca2cc76c10c4a836#file-microsoft-extensions-primitives-nuspec-L29

So we should fix the index to include 6.0 versions so that anything that's still built using pkgproj has the expected behavior as in past releases.

We should also be more intentional about preserving this behavior in libraries which move to CSProj. I believe we've discussed having validation for this @Anipik, here's a good use case.

cc @eerhardt

Author: ericstj
Assignees: -
Labels:

area-Infrastructure-libraries, untriaged

Milestone: -

@ericstj
Copy link
Member Author

ericstj commented May 5, 2021

Related: NuGet/Home#7344

@ericstj
Copy link
Member Author

ericstj commented May 5, 2021

Note: here we benefit from the fact that project.assets.json isn't trimmed to exclude the dependency groups for frameworks which are omitted from the package. It's not clear to me if that's always desired. @Anipik are you aware of any other case where we'd want to omit both the asset and the dependency group?

@ViktorHofer
Copy link
Member

So long as we ensure not to include ProjectReferences for inbox assemblies, we'll see an empty dependency group.

I would hope that NuGet/Home#7344 gets traction as I would really want to switch to P2Ps for inbox references at some point.

IMHO aside from security implications of dependencies I'm not too concerned about these added dependencies as they are trimmed out by package conflict resolution later anyway. Of course it would be great if we could avoid their download entirely but I see this more as an inconvenience and less as a blocker for the pkgproj migration.

@ericstj
Copy link
Member Author

ericstj commented May 5, 2021

really want to switch to P2Ps for inbox references at some point.

We'll need to solve hiding those P2Ps from NuGet anyway, can't have a package reference to System.Runtime, so I imagine we can choose to hide them on specific frameworks as well to get the right behavior without that NuGet feature. I'm with you on really wanting that NuGet feature though. I think it's a better and simpler overall story and make it so our customers don't need to have this complexity and still get similar benefits.

less as a blocker for the pkgproj migration.

Actually the projects that are migrated to CSProj coincidentally get the right behavior, so I wasn't thinking of it as a blocker. More that we'd want to be more intentional about that, and think about if it would ever be problematic.

@hoyosjs hoyosjs removed the untriaged New issue has not been triaged by the area owner label May 12, 2021
@hoyosjs hoyosjs added this to the 6.0.0 milestone May 12, 2021
@Anipik Anipik modified the milestones: 6.0.0, 7.0.0 Aug 4, 2021
@ViktorHofer
Copy link
Member

So we should fix the index to include 6.0 versions so that anything that's still built using pkgproj has the expected behavior as in past releases.

@ericstj given that we are past 6.0 and and pkgprojs and the packageindex don't exist anymore, should we close the issue?

@ViktorHofer ViktorHofer added the needs-author-action An issue or pull request that requires more info or actions from the author. label May 10, 2022
@ghost
Copy link

ghost commented May 10, 2022

This issue has been marked needs-author-action and may be missing some important information.

@ericstj
Copy link
Member Author

ericstj commented May 10, 2022

We should also be more intentional about preserving this behavior in libraries which move to CSProj.

Do we need anything to make sure that we don't unnecessarily rely on a PackageReference when an assembly is inbox?

If I look at our 7.0 packages, I see they have this problem.
https://www.nuget.org/packages/System.Net.Http.Json/7.0.0-preview.4.22229.4
https://www.nuget.org/packages/Microsoft.Extensions.Logging.Console/7.0.0-preview.4.22229.4

@ghost ghost added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels May 10, 2022
@ViktorHofer
Copy link
Member

ViktorHofer commented May 11, 2022

Do we need anything to make sure that we don't unnecessarily rely on a PackageReference when an assembly is inbox?

That behavior is intentional: #67196 (comment). We explicitly want to reference packages that also ship as part of the framework so that in case of a servicing event, the patched library reaches customers, even without updating the unpatched shared framework.

In your example above, we explicitly want to reference the System.Text.Json package.

@ViktorHofer ViktorHofer added the needs-author-action An issue or pull request that requires more info or actions from the author. label May 11, 2022
@ghost
Copy link

ghost commented May 11, 2022

This issue has been marked needs-author-action and may be missing some important information.

@ViktorHofer ViktorHofer removed the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label May 11, 2022
@ghost ghost added the no-recent-activity label May 25, 2022
@ghost
Copy link

ghost commented May 25, 2022

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@ghost
Copy link

ghost commented Jun 9, 2022

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@ghost ghost closed this as completed Jun 9, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 9, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-libraries needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity
Projects
None yet
Development

No branches or pull requests

4 participants