Skip to content

10.x on the .NET 11 runtime reads an hour of 24: {24:00:00} parses as {00:00:00} and T24:00:00 as the next day #300

Closed

Description

@CaffeinatedCoder

Problem

IsoTemporal hands an element's text to TimeOnly.TryParseExact, DateTime.TryParseExact and DateTimeOffset.TryParseExact. .NET 11 accepts an hour of 24 there where .NET 10 refuses it (#286). The 10.x packages target net10.0, but a net11.0 application that references them runs them on the .NET 11 BCL, so the shipped 10.0.0 answers differently by runtime.

Measured 2026-10-19 with the published 10.0.0 package: one net10.0 build of a probe, run on .NET 10.0.13 and, with --roll-forward Major, on .NET 11.0.0-rc.2:

Call .NET 10.0.13 .NET 11.0.0-rc.2
TimeSet.Parse("{24:00:00}", null) FormatException {00:00:00.0000000}
TimeRange.Parse("[23:00:00,24:00:00)", null) FormatException FormatException (24:00:00 became 00:00:00, below the lower bound)
DateTimeRange.Parse("[2026-01-01 00:00:00,2026-01-01T24:00:00)", null) 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)", null) FormatException [2026-01-01T00:00:00.0000000+00:00,2026-01-02T00:00:00.0000000+00:00)

PostgreSQL's time accepts 24:00:00 as a value TimeOnly cannot hold, and never prints a timestamp that way. Silent, on the .NET 11 runtime: #286's "no released version is affected" holds for the .NET 10 runtime only.

Change

The #286 fix ported to release/10.x: IsoTemporal refuses an hour of 24 before the BCL parse, for a time, a DateTime and a DateTimeOffset, with the TemporalLiteralGrammarTests rows (24:00, 24:00:00.0, T24:00:00, 24:00, T24:00:00Z). On the .NET 10 runtime nothing changes; on .NET 11, {24:00:00} throws where it returned midnight.

Release

silent, so a minor: ships in 10.1.0 (epic #296; decided 2026-10-19 to make the first 10.x release a minor so this rides along). The fix PR adds, at the top of the ## [10.1.0] section of the root and core changelogs, the ### Changed answers row linking this issue and the ## Changed answers in 10.1.0 section it adds to docs/migration.md (how to find the calls whose answer changed: any literal or JSON element with an hour of 24, which .NET 11 accepted and 10.1.0 refuses; on the .NET 10 runtime nothing changes). pr-hygiene.sh refuses a silent PR without that row and reads the version from the branch, so the PR comes after #301 step 1 has merged. 10.x CI can see the defect only by running the net10.0 test suites on a .NET 11 runtime (roll-forward), which the newest-toolchain leg of #297 could add; TemporalLiteralGrammarTests.Time_Rejects("24:00:00") is the test that fails there today.

Activity

  1. added
    bugSomething isn't working
    silentAnswers wrongly without throwing — fixes go in the next major, never deferred
    area/literalsParse, TryParse and formatting
    package/coreAffects CodoMetis.ValueRanges
    severity/mediumInconsistency or failure in a narrow scenario
    on Oct 19, 2026
  2. added this to the 10.1.0 milestone on Oct 19, 2026
  3. CaffeinatedCoder commented on Oct 19, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Fix ported in #308 against release/10.x (after #305 and #306 merged, so it is not stacked). Proved on the .NET 11.0.0-rc.2 runtime by running the net10.0 core test assembly under that host 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 10.0.13 and 11.0.0-rc.2 alike. Note for #297: dotnet test with DOTNET_ROOT set does not move the test host, because VSTest launches it from the muxer that runs vstest.console; run vstest.console.dll under the target host instead. This issue is closed by hand after the merge.

  4. CaffeinatedCoder commented on Oct 19, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Fixed on release/10.x by PR #308 (merge commit b74064a, 2026-10-19), with the ### Changed answers row and the ## Changed answers in 10.1.0 migration section. Closed by hand: Closes acts only on main, where the fix arrived with PR #292 (#286).

  5. CaffeinatedCoder commented on Oct 19, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Measured 2026-10-19 on release/10.x at 3ed738e: the whole 10.1.0 candidate passes on the .NET 11.0.0-rc.2 runtime (roll-forward), and with StartsWithHour24 stripped, 7 of the 115 grammar rows fail there and none on .NET 10. CI on release/10.x still can't see this; the leg that would is #324.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/literalsParse, TryParse and formattingbugSomething isn't workingpackage/coreAffects CodoMetis.ValueRangesseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions