Repository navigation
fix: refuse an hour of 24 in temporal text on the .NET 11 runtime too - #308
Merged
Merged
Conversation
IsoTemporal handed element text to TimeOnly.TryParseExact, DateTime.TryParseExact and
DateTimeOffset.TryParseExact. .NET 11 accepts an hour of 24 there where .NET 10 refuses
it, and this net10.0 assembly runs on the .NET 11 runtime inside a net11.0 application,
so the released 10.0.0 read `{24:00:00}` as `{00:00:00}` and `T24:00:00` as the next
day's midnight there, silently, while throwing FormatException on .NET 10.
IsoTemporal now refuses an hour of 24 before the BCL parse, for a time, a DateTime and
a DateTimeOffset, so a literal means the same on every runtime. Ported by hand from
PR #292 (231f23a, the #286 fix on main), with the TemporalLiteralGrammarTests rows
`24:00`, `24:00:00.0`, `T24:00:00`, ` 24:00`, `T24:00:00Z` and ` 24:00:00+05:30:00`.
Proved on the .NET 11.0.0-rc.2 runtime, the net10.0 test assembly run under
vstest.console with --roll-forward Major: without the fix Time_Rejects("24:00:00") and
the six new rows fail (7 of 115); with it all 115 pass, and the whole core project
passes on .NET 10.0.13 and 11.0.0-rc.2 alike. On .NET 10 the rows pass both ways.
A silent fix, so 10.1.0 is a minor: the root and core changelogs open the 10.1.0
section with "Changed answers", one row linking #300 and the new "Changed answers in
10.1.0" section of docs/migration.md, which says how to find the text whose reading
changed. docs/serialization.md's grammar list names the rule.
Found-By: OT
Defect-Class: LIT
Co-Authored-By: Claude Fable 5.1 <[email protected]>
CaffeinatedCoder
pushed a commit
that referenced
this pull request
Oct 19, 2026
Resolves the core changelog conflict with #308: the 10.1.0 section opens with Changed answers (#300), then Fixed (#299). Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.
Closes #300. The issue is closed by hand after the merge, because
Closesacts only onmain.Based on
release/10.xafter #305 (opens 10.1.0) and #306 merged; the### Changed answerssection sits above #306's### Fixedin the root changelog. The fix exists onmainin #292 (commit 231f23a, issue #286 on the 11 line) and is ported here by hand.Problem
IsoTemporalhands element text toTimeOnly.TryParseExact,DateTime.TryParseExactandDateTimeOffset.TryParseExact. .NET 11 accepts an hour of 24 there where .NET 10 refuses it. The 10.x packages targetnet10.0, but anet11.0application that references them runs them on the .NET 11 runtime, so the released 10.0.0 reads{24:00:00}as{00:00:00}andT24:00:00as the next day's midnight there, silently, while throwingFormatExceptionon .NET 10. Measured again with the published 10.0.0 package, onenet10.0build run on both runtimes:TimeSet.Parse("{24:00:00}")FormatException{00:00:00.0000000}TimeSet.TryParse("{24:00:00}")false{00:00:00.0000000}DateTimeRange.Parse("[2026-01-01 00:00:00,2026-01-01T24:00:00)")FormatException[2026-01-01T00:00:00.0000000,2026-01-02T00:00:00.0000000)DateTimeOffsetRange.Parse("[2026-01-01 00:00:00Z,2026-01-01T24:00:00Z)")FormatException[2026-01-01T00:00:00.0000000+00:00,2026-01-02T00:00:00.0000000+00:00)["24:00:00"]asTimeSetJsonException{00:00:00.0000000}Change
IsoTemporalrefuses an hour of 24 before the BCL parse, for a time, aDateTimeand aDateTimeOffset(StartsWithHour24), as build: retarget main to .NET 11 for 11.0.0-preview.1 #292 does onmain; the remark names 10.x on the .NET 11 runtime reads an hour of 24:{24:00:00}parses as{00:00:00}andT24:00:00as the next day #300 and the runtime situation of the 10.x line.TemporalLiteralGrammarTestsgains the rows24:00,24:00:00.0,T24:00:00,24:00,T24:00:00Zand24:00:00+05:30:00.silentfix, so it ships in the minor 10.1.0 with the form CONTRIBUTING.md asks for: the root and core changelogs open the## [10.1.0]section with### Changed answersand one row linking 10.x on the .NET 11 runtime reads an hour of 24:{24:00:00}parses as{00:00:00}andT24:00:00as the next day #300 and the new## Changed answers in 10.1.0section ofdocs/migration.md, which says how to find the text whose reading changed (any literal, JSON element or bound value with an hour of 24, read as midnight on .NET 11 before 10.1.0 and refused after; on the .NET 10 runtime nothing changes).docs/serialization.md's grammar list names the rule.Tests
The defect is visible only on the .NET 11 runtime, so the proof runs the
net10.0core test assembly twice: on the SDK's .NET 10.0.13 throughdotnet test, and on .NET 11.0.0-rc.2 (installed withdotnet-install.sh --channel 11.0 --quality preview --runtime dotnet) by running the SDK'svstest.console.dllunder that host with--roll-forward Major, which the test host's diagnostic log confirms (Runtime location: …/dotnet11/shared/Microsoft.NETCore.App/11.0.0-rc.2.26504.105). Plaindotnet testwithDOTNET_ROOTset does not reach the test host: VSTest launches it from the muxer that runsvstest.console, so that run stays on .NET 10 and passes.TemporalLiteralGrammarTests,--filter FullyQualifiedName~TemporalLiteralGrammarTests:Time_Rejects("24:00:00")Time_Rejects("24:00:00"),Time_Rejects("24:00"),Time_Rejects("24:00:00.0"),DateTime_Rejects("2027-02-01T24:00:00"),DateTime_Rejects("2027-02-01 24:00"),DateTimeOffset_Rejects("2026-01-01T24:00:00Z"),DateTimeOffset_Rejects("2026-01-01 24:00:00+05:30:00")The failure on .NET 11 without the fix:
With the fix, the whole core project (1397 tests) passes on both runtimes. Also green locally: the conventions tests (403, including
ChangelogConventionTestsand the claim catalogue), the ASP.NET Core host tests (92), the NodaTime tests (238) and both EF Core translation projects (289 and 83)..github/scripts/pr-hygiene.shon an event with this PR's labels passes, and fails with the expected message when the### Changed answersheading is renamed.CI on the 10.x line cannot see this defect until #297 adds a .NET 11 runtime roll-forward leg;
TemporalLiteralGrammarTests.Time_Rejects("24:00:00")is the row that fails there today.🤖 Generated with Claude Code