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

Fix DateOnly and TimeOnly Formatting using interpolated strings #64398

Merged

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jan 27, 2022

Fixes #64292

@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 Jan 27, 2022

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #64292

Author: tarekgh
Assignees: tarekgh
Labels:

area-System.Runtime

Milestone: -

@tarekgh tarekgh added this to the 7.0.0 milestone Jan 27, 2022
Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Thanks! It's interesting this doesn't cause any tests to fail. Are we missing direct tests of TryFormat?

@tarekgh
Copy link
Member Author

tarekgh commented Jan 27, 2022

It's interesting this doesn't cause any tests to fail. Are we missing direct tests of TryFormat?

We were testing the positive cases only. I added the interpolated string tests which should catch the negative cases. If you think we should add specific negative tests for TryFormat, I can do that. We already testing the not enough destination buffer space here

Assert.False(dateOnly.TryFormat(buffer.Slice(0, 3), out charsWritten));
. and here
Assert.False(timeOnly.TryFormat(buffer.Slice(0, 3), out charsWritten));

@stephentoub
Copy link
Member

Thanks. Yes, I think we should have those tests for TryFormat. It'd be fine to do those instead of the interpolation ones.

@tarekgh
Copy link
Member Author

tarekgh commented Jan 28, 2022

The failures in the CI are tracked by the issue #64389.

@tarekgh tarekgh merged commit f8f486b into dotnet:main Jan 28, 2022
@tarekgh tarekgh deleted the FixDateAndTimeOnlyWithInterpolatedStringFormatting branch January 28, 2022 02:16
@tarekgh
Copy link
Member Author

tarekgh commented Jan 28, 2022

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1762869247

@ghost ghost locked as resolved and limited conversation to collaborators Feb 27, 2022
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.

Invalid format specifier on DateOnly in string interpolation leads to infinite loop instead of FormatException
3 participants