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

[release/6.0-preview2] Track trailing zeros only for floating point numbers #48857

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 27, 2021

Backport of #48608 to release/6.0-preview2

/cc @jeffhandley @pgovind @tannergooding

Customer Impact

Fixes #48604 and #48648. #47666 introduced a regression in the parsing routine and made it to the P2 snap. This PR fixes that regression.

This issue is widespread; 2 common cases that are broken with the current P2 bits are:

  1. int.Parse("3.00", options) throws an exception. This is fixed by this PR.
  2. string -> decimal -> string roundtripping is also broken. ASP.NET hit this issue in their testing of the current P2 bits. This is also fixed by this PR.

Testing

ASP.NET also found the regression in their testing of the P2 bits. I got sign-off from ASP.NET for the fix from @pranavkm. I've also added new unit tests to test our parsing logic better.

As we investigated and resolved this, we concluded that our test coverage of number formatting/parsing is generally insufficient. We will schedule work later in the release to introduce significantly more comprehensive test coverage.

Risk

Minimal. We're broken already, and this fixes the break. I've also reduced the scope of the change to only affect parsing floating point types.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Feb 27, 2021

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

Issue Details

Backport of #48608 to release/6.0-preview2

/cc @jeffhandley @pgovind @tannergooding

Customer Impact

Fixes #48604 and #48648. #47666 introduced a regression in the parsing routine and made it to the P2 snap. This PR fixes that regression.

Testing

ASP.NET also found the regression in their testing of the P2 bits. I got sign-off from ASP.NET for the fix from @pranavkm. I've also added new unit tests to test our parsing logic better.

Risk

Minimal. We're broken already, and this fixes the break. I've also reduced the scope of the change to only affect parsing doubles.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Numerics

Milestone: -

@danmoseley
Copy link
Member

Could you please include in the template why we should take the change. I assume in this case we think the impact is widespread.

Did you get a chance to run your new changes against all the inputs in https:/nigeltao/parse-number-fxx-test-data/tree/main/data as suggested in #48648?

@@ -1500,6 +1500,14 @@ public static void ToString_InvalidFormat_ThrowsFormatException()
Assert.Throws<FormatException>(() => f.ToString("E" + intMaxPlus1String));
}

[Theory]
[InlineData("3.00")]
Copy link
Member

Choose a reason for hiding this comment

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

Aren't there a bunch of other possible inputs here -- or conversely, should this just be a case added to an existing test?

Copy link
Member

Choose a reason for hiding this comment

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

As @pgovind said, "Yup. This is just the start." We will be creating an issue for later in the release cycle to strategically and comprehensively improve the coverage of all of the formatting/parsing logic.

Copy link
Member

Choose a reason for hiding this comment

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

This specific scenario is the one that ASP.NET reported as broken, FYI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't there a bunch of other possible inputs here

There are. The plan is to have a working group some time soon to improve our unit tests for the parsing and formatting routines. I expect that this unit test will be folded into whatever we create at that point OR we'll add those inputs to this unit test.

Copy link
Member

Choose a reason for hiding this comment

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

OK

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Could you please include in the template why we should take the change. I assume in this case we think the impact is widespread.

Yup, the impact is widespread. 2 common cases that are broken with the current P2 bits are:

int.Parse("3.00", options) throws an exception. This is fixed by this PR
string->decimal->string roundtripping is also broken. ASP.NET hit this issue in their testing of the current P2 bits. This is also fixed by this PR.

@danmoseley
Copy link
Member

OK, seems reasonable for Preview 2.

@danmoseley danmoseley added the Servicing-approved Approved for servicing release label Feb 27, 2021
@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Did you get a chance to run your new changes against all the inputs in https:/nigeltao/parse-number-fxx-test-data/tree/main/data as suggested in #48648?

Not yet. This is part of the plan for the working group. Though I guess I can run this locally right now while waiting for the build. I'll report what I find here.

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Ok, I can confirm that all the tests mentioned in that issue (ibm-fpgen.txt) pass locally

@danmoseley
Copy link
Member

Ok thanks. Might be worth a check at some point that we have 100% code coverage of this stuff but not suggesting it's necessary for this change.

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Test failures are unrelated. Merging (I assume I can. If not, it should be easy enough to revert).

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Oh apparently, I need someone to officially approve the PR. Alright, whoever approves the PR, please merge it too!

@jeffhandley
Copy link
Member

@pgovind @danmoseley I don't have permission to merge; I'm not sure who does. I just fired off a re-run of the checks that had failed though.

@danmoseley
Copy link
Member

Any of us should be able to merge

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Weird, I see a message that says “you’re not authorized to merge this PR”

@jeffhandley
Copy link
Member

I'm assuming it's because the CI is red and the branch protection is blocking. We'll see if re-running these legs gets it green. We can check in on it again tomorrow.

@pgovind
Copy link
Contributor

pgovind commented Feb 27, 2021

Oh wait I remember stephentoub commenting somewhere that we disabled some dns tests in runtime recently. I wonder if these are the same failures. Will check if this is the case later today

@danmoseley danmoseley merged commit ae5d716 into release/6.0-preview2 Feb 28, 2021
@danmoseley danmoseley deleted the backport/pr-48608-to-release/6.0-preview2 branch February 28, 2021 00:50
@danmoseley
Copy link
Member

Merge worked for me. Failures were #48751

@jeffhandley
Copy link
Member

Thanks, @danmoseley!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Numerics Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants