-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
Index and Range APIs are netcoreapp3.0+ only. Includes System.Text.Rune for netstandard2.0, since that is currently only netcoreapp3.0.
Getting the full build working again.
Get the package building.
Note regarding the 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. |
…c with cancellation.
14fc1d9
to
7daf535
Compare
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
src/libraries/System.Private.CoreLib/src/System/Text/Utf8Span.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/tests/System/Utf8SpanTests.Searching.TestData.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/ref/System.Utf8String.Experimental.csproj
Show resolved
Hide resolved
There was a problem hiding this 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!
src/libraries/System.Private.CoreLib/src/System/Text/Utf8Span.Conversion.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Text/Utf8Span.Searching.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Text/Utf8Span.Searching.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/src/System/Runtime/Intrinsics/Intrinsics.Shims.cs
Outdated
Show resolved
Hide resolved
I believe I have addressed all existing feedback. Please take a look and let me know if you have any more. |
93900e1
to
735317d
Compare
I'm removing the "new-api-needs-documentation" label on this PR since there is no new API being introduced. |
src/libraries/System.Private.CoreLib/src/System/Text/Utf8Span.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Text/Utf8StringComparer.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Utf8String.Construction.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/src/System/Net/Http/Utf8StringContent.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/src/System/Utf8String.Portable.cs
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/src/System/Utf8String.Portable.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/tests/System/ReflectionTests.netfx.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/tests/System/Utf8SpanTests.Conversion.cs
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/tests/System/Utf8StringTests.Ctor.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Utf8String.Experimental/ref/System.Utf8String.Experimental.csproj
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Utf8String.Construction.cs
Outdated
Show resolved
Hide resolved
<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'"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- Build, ship, and stabilize along with the rest of the product.
- Build, ship, but do not stabilize along with the rest of the product.
- 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.
There was a problem hiding this comment.
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:
Lines 75 to 76 in 73268c7
<SuppressFinalPackageVersion Condition="'$(SuppressFinalPackageVersion)' == '' and $(MSBuildProjectName.Contains('Experimental'))">true</SuppressFinalPackageVersion> | |
<IsShippingAssembly Condition="$(MSBuildProjectName.Contains('Experimental'))">false</IsShippingAssembly> |
cc: @mmitche @danmosemsft
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #33636
There was a problem hiding this comment.
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.
Fix #29442