CNA-GAP-034: The XNB DateTime reader discards the two DateTimeKind bits, so Utc and Local values load as plain tick counts
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
DateTimeReader masks off the two kind bits and returns System::DateTime(ticks) with an unspecified kind, and it does not convert a Local-kind value to local time as XNA does. The header justifies the deviation by System::DateTime not modelling a kind, but System::DateTime has a (ticks, DateTimeKind) constructor at TARGET, so that reason is stale.
- Identifier
CNA-GAP-034- Category
- Functional gap
- Subsystem
- Content & XNB/CNB/CNJ
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- XNB DateTime values read through ContentReader (DateTimeReader)
Expected behaviour
XNA's DateTimeReader restores DateTimeKind from the top two bits and, for a Local value, converts the stored UTC ticks to local time (new DateTime(ticks, Utc).ToLocalTime()).
Actual behaviour at TARGET
DecimalDateTimeContentTypeReaders.hpp applies kindMask = 3 << 62 and returns System::DateTime(ticks). Its comment documents this as a deliberate deviation because System::DateTime 'does not store/track DateTimeKind at all'; that premise is out of date, since CNA's own XnaIntermediateSerializerTests builds Utc values with System::DateTime(ticks, System::DateTimeKind::Utc). The XNB writer in XnbBuiltInWriters.cpp likewise writes Unspecified. A Local-kind value therefore loads as its stored UTC ticks, without XNA's offset conversion.
Source locations
modules/content/include/CNA/Internal/Xnb/DecimalDateTimeContentTypeReaders.hpp— DateTimeReader kindMask and the documented deviationmodules/content/tests/CNA/Internal/Xnb/DecimalDateTimeContentTypeReaderTests.cpp— reader tests
Evidence
Checked by reading at 009d40f5; not executed.
Independent re-verification: Checked by reading at 009d40f5; not executed. XNA behaviour from the decompiled DateTimeReader. sharp-runtime's DateTime kind storage (packed in the top two bits, ticket 1941) landed on 2026-08-19, before the TARGET commit, and was read there through git only.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
DecimalDateTimeContentTypeReaderTests.cpp covers the reader.
Regression test
If Sharp Runtime gains a kind: a round trip of Utc and Local values.
Blast radius
Content that serialises DateTime with a kind; the tick value is preserved.
Workaround
No workaround is known.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Internals
- Content runtime: the XNB tier
- Deep dives
- XNB type readers: scalar and math
- Known issues
- Functional gap index