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

Correcting Mismatch between ref and src #39741

Merged
merged 2 commits into from
Jul 30, 2020
Merged

Correcting Mismatch between ref and src #39741

merged 2 commits into from
Jul 30, 2020

Conversation

Anipik
Copy link
Contributor

@Anipik Anipik commented Jul 21, 2020

working towards #26187
Changing src to match ref.

In order to change ref we need api approval.
Some small genapi related re ordering of members.

cc @buyaa-n @safern @tannergooding @carlossanlop @dotnet/ncl @tarekgh

@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.

@ghost
Copy link

ghost commented Jul 21, 2020

Tagging subscribers to this area: @safern, @ViktorHofer
Notify danmosemsft if you want to be subscribed.

@Anipik Anipik changed the title [Donot Review] Correcting Mismatch between ref and src Correcting Mismatch between ref and src Jul 22, 2020
@@ -226,9 +226,9 @@ public static bool TryParse([NotNullWhen(true)] string? ipString, [NotNullWhen(t
return (address != null);
}

public static bool TryParse(ReadOnlySpan<char> ipSpan, [NotNullWhen(true)] out IPAddress? address)
public static bool TryParse(ReadOnlySpan<char> ipString, [NotNullWhen(true)] out IPAddress? address)
Copy link
Member

Choose a reason for hiding this comment

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

@dotnet/ncl this looks like less desirable than what was previously here. If you intended to change the reference assembly prameter name, take that through API review and file a breaking change issue.

Copy link
Member

Choose a reason for hiding this comment

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

Original API proposal: #22918
public static bool TryParse(ReadOnlySpan<char> ipChars, out IPAddress address);

According to the original issue, it should be ipChars. The code is quite old (merged 3 years ago on Aug 22, 2017). @karelz is parameter name change breaking change? If not, should we align it with the original API proposal?

Copy link
Member

Choose a reason for hiding this comment

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

The publicly documented API is ipString https://docs.microsoft.com/en-us/dotnet/api/system.net.ipaddress.tryparse?view=netcore-3.1#System_Net_IPAddress_TryParse_System_ReadOnlySpan_System_Char__System_Net_IPAddress__

It's also what we've shipped since 2.1 dotnet/corefx@0029b32#diff-08121b9ae82947c9c21c6bb7c18202a4R223

is parameter name change breaking change?

It's source breaking when source uses named parameters. EG:

        ReadOnlySpan<char> ip = "1.1.1.1";
        IPAddress res;
        IPAddress.TryParse(ipString: ip, out res);

If you were to correct the ref, this source would break.

Technically changing implementation is also observable, through reflection, but we typically prioritize avoiding source breaking changes on these issues.

Copy link
Member

Choose a reason for hiding this comment

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

@dotnet/ncl please weigh in on what you'd like to do here.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We should keep the same name we had in previous release 3.1 IMO ... at this stage of 5.0, I would avoid discussions about changing param name.
How was the discrepancy introduced?

Copy link
Member

Choose a reason for hiding this comment

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

In the original PR, just overlooked when doing review I guess.

Copy link
Member

Choose a reason for hiding this comment

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

@karelz we're weighing which way is less breaking (fixing ref vs fixing src). Currently we're thinking fixing ref is less breaking, and we still have a chance to do that. Are you suggesting that instead we don't make any changes and keep ref and src out of sync?

Copy link
Member

@karelz karelz Jul 28, 2020

Choose a reason for hiding this comment

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

OK, the original PR dotnet/corefx#23224 introduced the inconsistency: ref with ipString, but implementation with ipSpan (while approved API asked for ipChars).
I agree that changing the implementation to match the ref name makes most sense at this point -- it is the least breaking.

I don't think it is worth to make the breaking change of parameter name in ref in 5.0 (and likely never).

Copy link
Member

Choose a reason for hiding this comment

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

(our replies crossed and I didn't see your summary in #39741 (comment))

Honestly, it probably does not matter which way we go. I am fine to go with recommendation from API review folks. ipSpan is not ideal ... if API review group is fine with such arg name, we can use it. Otherwise, let's stick to ipString.
The risk of breaking customers is either way fairly small IMO.

@@ -66,10 +66,10 @@ public StackFrame()
/// <summary>
/// Constructs a StackFrame corresponding to the active stack frame.
/// </summary>
public StackFrame(bool needFileInfo)
public StackFrame(bool fNeedFileInfo)
Copy link
Member

Choose a reason for hiding this comment

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

This is another potentially undesirable change, however preserves compat. cc @tommcdon

Copy link
Member

Choose a reason for hiding this comment

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

@Anipik
Copy link
Contributor Author

Anipik commented Jul 23, 2020

@ericstj @safern @ViktorHofer can u approve this one ?

@ViktorHofer
Copy link
Member

ViktorHofer commented Jul 23, 2020

I defer to @ericstj or @safern to approve as I'm not an expert in detecting breaking changes :)

@safern
Copy link
Member

safern commented Jul 23, 2020

@ericstj I guess we will need to file breaking change issues for all parameter name changes in implementation given it is a reflection breaking change?

@ericstj
Copy link
Member

ericstj commented Jul 23, 2020

given it is a reflection breaking change?

Possibly, though as I mentioned we considered changing the ref more breaking than "fixing" the src to match the ref. I'd prefer we git area-owners to chime in on what's best for their own API and then based on that decide if they need to document a break.

@ericstj
Copy link
Member

ericstj commented Jul 23, 2020

Actually thinking through this a bit more. It looks to me like largely the runtime side of these has better naming.

The reference side, though more breaking, is less likely to block someone. If they happened to be using named parameters they'll see a compile error with an easy fix.

Compare that to the runtime side which may result in different behavior or exception. At this point a developer may be blocked if they don't have the ability to recompile the code.

I think I'm going to flip on this and reccomend we update refs to match src and just file the breaking change notice for refs. cc @terrajobst @stephentoub in case I'm missing something.

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM

Let's make sure to file a breaking change notice mentioning all the places where the parameter names change on references, noting it breaks source that referred to these using named-parameters.

@ericstj ericstj added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Jul 30, 2020
@Anipik
Copy link
Contributor Author

Anipik commented Jul 30, 2020

Created the breaking change notice dotnet/docs#19763

@Anipik Anipik merged commit 621ed57 into dotnet:master Jul 30, 2020
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@Anipik Anipik deleted the ref branch August 25, 2020 21:51
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-libraries breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants