Conversation
…ws for invalid DateTimeStyles Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [Breaking change] Fix DateOnly/TimeOnly TryParse to throw on invalid inputs
docs: breaking change - DateOnly/TimeOnly TryParse throws ArgumentException for invalid DateTimeStyles (.NET 11)
Mar 19, 2026
gewarren
approved these changes
Mar 19, 2026
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new .NET 11 breaking change compatibility article documenting that DateOnly/TimeOnly TryParse and TryParseExact APIs throw ArgumentException for invalid DateTimeStyles values (and invalid format specifiers), and wires the article into the .NET 11 compatibility index and TOC.
Changes:
- Added a new breaking change article for
DateOnly/TimeOnlyparsing behavior in .NET 11 Preview 2. - Linked the new article from the .NET 11 “Core .NET libraries” breaking changes table.
- Added the new article to the compatibility TOC under .NET 11 > Core .NET libraries.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md | New breaking change article describing the behavior change, rationale, mitigation, and affected APIs. |
| docs/core/compatibility/11.md | Adds the new breaking change entry to the .NET 11 index table. |
| docs/core/compatibility/toc.yml | Adds the new article to the .NET 11 TOC under Core .NET libraries. |
You can also share your feedback on Copilot code review. Take the survey.
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Show resolved
Hide resolved
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Show resolved
Hide resolved
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In .NET 11 Preview 2,
DateOnly.TryParse,DateOnly.TryParseExact,TimeOnly.TryParse, andTimeOnly.TryParseExactchanged from silently returningfalseto throwingArgumentExceptionwhen passed invalidDateTimeStylesvalues or format specifiers.Changes
docs/core/compatibility/core-libraries/11/dateonly-timeonly-tryparse-argumentexception.md— covers previous/new behavior, reason (consistency with otherTryParseAPIs), recommendedtry/catchmigration pattern, and all 8 affected API xrefsdocs/core/compatibility/11.md— added entry to Core .NET libraries breaking changes tabledocs/core/compatibility/toc.yml— added TOC entry under .NET 11 > Core .NET librariesBehavior delta
Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.
Internal previews