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

Allow Utf8String package to work on netstandard 2.0 #33357

Merged
merged 26 commits into from
Mar 14, 2020

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Mar 8, 2020

Fix #29442

@Dotnet-GitSync-Bot
Copy link
Collaborator

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

src/libraries/System.Private.CoreLib/src/System/Index.cs Outdated Show resolved Hide resolved
src/libraries/System.Private.CoreLib/src/System/Index.cs Outdated Show resolved Hide resolved
@@ -47,12 +52,17 @@ public Range(Index start, Index end)
/// <summary>Returns the hash code for this instance.</summary>
public override int GetHashCode()
{
#if SYSTEM_PRIVATE_CORELIB || NETCOREAPP
Copy link
Member

Choose a reason for hiding this comment

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

In some other places where we've had these one-off experimental downlevel packages, we've instead chosen to just duplicate/specialize the source, with dedicated files for that package, rather than complicating shared code with lots of ifdefs that we'll likely end up removing in the near future. Might want to consider that with this, too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've simplified the ifdefs in this file, so it looks much better now. I can split the GetHashCode and ToString out into specialized files if you still think it is worth it.

src/libraries/System.Private.CoreLib/src/System/Range.cs Outdated Show resolved Hide resolved
@@ -20,6 +20,10 @@ namespace System.Text
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly struct Rune : IComparable<Rune>, IEquatable<Rune>
{
private const char HIGH_SURROGATE_START = '\ud800';
private const char LOW_SURROGATE_START = '\udc00';
private const int HIGH_SURROGATE_RANGE = 0x3FF;
Copy link
Member

Choose a reason for hiding this comment

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

Can we use PascalCase for such consts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can. I copied this from existing code in CharUnicodeInfo. Do you think I should change all the existing occurrences to PascalCase as well?

https://github.com/dotnet/runtime/search?l=C%23&q=HIGH_SURROGATE_START

@eerhardt eerhardt marked this pull request as ready for review March 9, 2020 22:46
Copy link
Member

@GrabYourPitchforks GrabYourPitchforks left a comment

Choose a reason for hiding this comment

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

I haven't gotten through it all yet but wanted to give some preliminary feedback. Will take another stab tomorrow.

Thanks so much for getting this PR out!

@eerhardt
Copy link
Member Author

I believe I have addressed all existing feedback. Please take a look and let me know if you have any more.

@eerhardt
Copy link
Member Author

I'm removing the "new-api-needs-documentation" label on this PR since there is no new API being introduced.

@eerhardt eerhardt merged commit 98d9e7e into dotnet:master Mar 14, 2020
@eerhardt eerhardt deleted the Utf8StringPackaging branch March 14, 2020 15:43
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- disable warnings about obsolete APIs -->
<NoWarn>$(NoWarn);0809;0618</NoWarn>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.0;$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Condition="'$(IsPrerelease)' != 'false'">
Copy link
Member

Choose a reason for hiding this comment

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

Should the whole project be disabled when IsPrerelease=true? None of this should be building in release branches.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I assumed that's what this line was intending to do.

@GrabYourPitchforks @joperezr @safern - thoughts on how to do this?

Copy link
Member

Choose a reason for hiding this comment

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

Should the whole project be disabled when IsPrerelease=true? None of this should be building in release branches.

Really? You don't even want to ship previews?

Here are the set of "modes" that folks usually wish to fall into:

  1. Build, ship, and stabilize along with the rest of the product.
  2. Build, ship, but do not stabilize along with the rest of the product.
  3. Build, but do not ship nor stabilize along with the rest of the product.

Let me know which of these fits the best, or if you have different requirements than what is discussed here.

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 we agreed that this should be built in release branches as we still want to ship the experimental packages to nuget but they won't be marked as stable... so to me this condition is no longer needed as we control the package versioning through other properties like:

<SuppressFinalPackageVersion Condition="'$(SuppressFinalPackageVersion)' == '' and $(MSBuildProjectName.Contains('Experimental'))">true</SuppressFinalPackageVersion>
<IsShippingAssembly Condition="$(MSBuildProjectName.Contains('Experimental'))">false</IsShippingAssembly>

cc: @mmitche @danmosemsft

Copy link
Member

Choose a reason for hiding this comment

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

I didn't have @ericstj reply when I was responding, so basically what we do now using the properties above is number 2.

Build, ship, but do not stabilize along with the rest of the product.

Copy link
Member

Choose a reason for hiding this comment

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

We have not been shipping experimental packages to nuget.org. For example, System.Runtime.Intrinsics.Experimental was not on nuget.org for 3.0. People who wanted to use the experimental packages had no problem with using them from the daily feeds.

That was a bug that I introduced in 3.0 and fixed in 5.0.

dotnet/corefx#41513

I had a discussion with @danmosemsft @ericstj and @GrabYourPitchforks and we agreed we wanted them in NuGet to raise visibility and usage of the packages, but they would only ship non-stable versions until they're marked as non-experimental.

If we want to not have them in NuGet, IsPrerelease is not the way to go anyway, we would need to tweak the IsShippingPackage property to set it to false for these packages.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that publishing experimental packages to nuget.org sends the wrong message. A developer can easily get confused about what is supported.

Keeping experimental packages off of nuget.org, and forcing users to opt-in by using a different package feed, makes it even more clear that this package isn't intended for production usage.

Copy link
Member

Choose a reason for hiding this comment

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

I recall the agreement being similar to what Jan said: no building in release branches, no servicing. I'm impartial as to whether or not we publish to nuget.org. Our readme already gives the correct acquisition URL for the install-package command.

Copy link
Member

Choose a reason for hiding this comment

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

Opened #33636

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I discussed this earlier with @eerhardt and it makes sense we should keep them off nuget as it's inevitable they will be perceived as supported.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate allowing Utf8String package to work on netstandard 2.0
9 participants