-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix invalid "yyy" format processing for DateTime parse #115507
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
Fix invalid "yyy" format processing for DateTime parse #115507
Conversation
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.
The desired behavior hasn't been confirmed by the area owner.
@@ -1,4 +1,5 @@ | |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
|
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.
Don't commit changes to solution files. They are auto generated and owned by infrastructure.
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.
Thanks, I don't known about it. Reverted by 1f62c3a , but current solution does not build from VS without this change.
@@ -1,4 +1,4 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. |
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.
Avoid BOM changes for existing files
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.
Fixed by 89425c2
@@ -4055,7 +4057,7 @@ private static bool ParseByFormat( | |||
{ | |||
parseInfo.fUseTwoDigitYear = true; | |||
} | |||
parseResult = ParseDigits(ref str, tokenLen, out tempYear); | |||
parseResult = ParseDigits(ref str, tokenLen, maxYearTokenLength, out tempYear); | |||
} |
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.
parseResult = ParseDigits(ref str, tokenLen, maxDigitLen: tokenLen <= 2 ? 2 : 4, out tempYear);
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 the test https://helixr1107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-115507-merge-c1d147295e6d448da4/System.Net.Http.Functional.Tests/3/console.a9f6f133.log?helixlogtype=result failed because you didn't handle the token length 2
. Try the suggestion and let's see if this test will still fail.
@@ -4028,6 +4028,8 @@ private static bool ParseByFormat( | |||
DateTimeFormatInfo dtfi, | |||
scoped ref DateTimeResult result) | |||
{ | |||
const int maxYearTokenLength = 4; |
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.
Thinking more, I think this change can break other cases today like parsing |
Current PR fixes #51860 issue