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

Remove upper bound on System.Text.Json package reference #117

Merged
merged 6 commits into from
Nov 15, 2024

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Nov 13, 2024

Fixes #116

@stephentoub stephentoub requested a review from a team as a code owner November 13, 2024 05:15
calebkiage
calebkiage previously approved these changes Nov 13, 2024
@calebkiage
Copy link

The range was introduced in this commit Set System.Text.Json version range to support older LTS runtimes.. The lower bound makes sense, I don't think the upper bound is needed.

Copy link
Member

@baywet baywet 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 the contribution!

We'd like to keep an upper bound to give us the opportunity to review and potentially fix any breaking changes in future releases.

@@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="[6.0,9.0)" />
<PackageReference Include="System.Text.Json" Version="[6.0,)" />
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<PackageReference Include="System.Text.Json" Version="[6.0,)" />
<PackageReference Include="System.Text.Json" Version="[6.0,10.0)" />

Copy link
Member Author

Choose a reason for hiding this comment

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

Setting upper bounds like this is problematic for the ecosystem. I understsnd you're concerned about compat, but setting this bound effectively guarantees consuming apps and libraries will be unable to upgrade to newer versions of .NET until the bound is addressed. It's an antipattern.

I'll accept the suggestion in the name of making forward progress here, but please reconsider removing the bounds entirely.

cc: @ericstj

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the insight! I'd be incredibly helpful if that recommendation which is already present in the library authors guidance could be accompanied by rationale on why this is not a problem on compat.

Copy link
Member

Choose a reason for hiding this comment

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

Setting the upper bound does not do anything to change how NuGet's algorithm behaves when making choices -- all it does is introduce a failure when folks violate the upper bound. This hinders compat because it prevents/discourages folks from using a library that might (should!) just work.

We build tooling that helps folks ensure that they build compatible libraries https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/overview, and for System.Text.Json we run this tooling and have very high bar for compatibility since it's also part of .NET and is updated in place for customers.

Compatibility is the norm and should be expected. Only when a known compatibility problem exists should you consider using upper bounds.

baywet
baywet previously approved these changes Nov 14, 2024
@baywet baywet enabled auto-merge November 14, 2024 11:09
@@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="[6.0,9.0)" />
<PackageReference Include="System.Text.Json" Version="[6.0,10.0)" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this prevent people from testing applications using .NET 10 previews next year?

Copy link
Member

Choose a reason for hiding this comment

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

yes, that's what our team (OpenAPI.net, OpenAPI.net.Odata, this. Microsoft.Plugins.Manifest, kiota, Microsoft.Graph....) has been doing for the past couple of years.
This requires us to be reactive, but gives an escape hatch in case a breaking change would happen with the new version.

Copy link
Contributor

Choose a reason for hiding this comment

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

The doesn't sound ideal if it blocks people from being able to test their apps with .NET 10 at all if you don't relax the restriction until November 2025.

I don't happen to use anything that depends on this assembly, but I test my apps with every preview of .NET before they reach GA. This restriction would be a blocker to any such testing, and it's also not good for users who want to adopt .NET vNext on day 0 and find it to be impossible due to the upper constraint.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does Microsoft.OpenApi have such a restriction? I've had zero issues with it with testing the new Microsoft.AspNetCore.OpenApi package in the .NET 9 previews and the final release. If it did, I feel I'd have opened an issue against it many many months ago about it asking for it to be removed already.

Copy link
Member

Choose a reason for hiding this comment

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

Microsoft.OpenAPI is just a set of abstractions, so it does not have any dependencies.
Microsoft.OpenApi.Readers does not depend on STJ (or newtonsoft), but rather on sharpYAML

This is one of the improvements of the upcoming v2 which now makes me realize using a range was forgotten in the process.

Created an issue to address this before the GA microsoft/OpenAPI.NET#1930

Copy link
Contributor

@martincostello martincostello Nov 14, 2024

Choose a reason for hiding this comment

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

My issue with this is that it allows you to review any breaking changes, but doesn't allow anyone else to.

This removes a lot of the value to the .NET teams (and yourselves) of customers using your libraries in their own applications and providing feedback over the course of the .NET 10 development lifecycle. If anyone finds an issue you don't find yourself, you won't find out about it until .NET 10 GA, at which point it's "too late".

My take is it's much better to not have the upper bound, and then let people take it for a spin themselves. If there are issues, you'll get bug reports and they can be resolved in advance of .NET 10 GA. If there aren't any issues, everyone's happy and there's nothing to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise, there's a very good chance I'll pop up in February 2025 with an issue saying I can't test any of my OpenAPI-consuming applications with .NET 10 previews and asking for a fix 😃

@baywet
Copy link
Member

baywet commented Nov 15, 2024

thank you @stephentoub @martincostello @ericstj for your super helpful input here! The reasoning you've provided makes a lot of sense. I think I was operating from a more semver based approach, which the core libraries of net do not follow (i.e. major versions are created without source breaking changes in the vast majority of cases).

I have updated this PR to remove the bound, and bump the version for publishing.

@baywet baywet merged commit 9c38f61 into microsoft:main Nov 15, 2024
6 checks passed
@stephentoub stephentoub deleted the patch-1 branch November 15, 2024 15:38
@ericstj
Copy link
Member

ericstj commented Nov 15, 2024

SemVer doesn't say a major version has to contain breaking changes. It says that if you make breaking changes you MUST make a major version change. You MAY make a major version change with other changes.

For .NET we also the concern of product branding. We have had a lot of feedback over the years that folks want consistent branding for the things thar are part of .NET. As a result we version all the packages to be consistent with the release wave. We strive for zero breaking changes in a release (since it increases friction for updates) but occasionally there are small breaks which we document in https://learn.microsoft.com/en-us/dotnet/core/compatibility/breaking-changes.

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.

Why does this library prohibit using System.Text.Json 9.0?
5 participants