Skip to content

Avoid temporary string in CBOR timestamp formatting - #136803

Merged
stephentoub merged 1 commit into
mainfrom
stephentoub-cbor-timestamp-formatting
Nov 2, 2026
Merged

stephentoub merged 1 commit into
mainfrom
stephentoub-cbor-timestamp-formatting

Conversation

@stephentoub

@stephentoub stephentoub commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

CborWriter.WriteDateTimeOffset currently allocates a temporary string solely to pass it to the text-string writer. Format into a bounded 33-character stack buffer with TryFormat and pass the written span to the existing writer instead.

Keep the invariant RFC 3339 custom format, UTC Z spelling, fractional trailing-zero trimming, and existing tag/context handling unchanged. netstandard2.0 and .NET Framework retain the original ToString path. Extend the existing tests with focused fraction, offset, date-limit, maximum-length, and culture-invariance cases.

Format RFC 3339 timestamps into bounded stack storage on modern .NET while retaining legacy target behavior. Extend focused timestamp edge and culture coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-formats-cbor, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

vcsjones
vcsjones previously approved these changes Nov 1, 2026
@vcsjones
vcsjones dismissed their stale review November 1, 2026 22:21

Question first

@stephentoub
stephentoub merged commit 82d89ec into main Nov 2, 2026
87 of 90 checks passed
@stephentoub
stephentoub deleted the stephentoub-cbor-timestamp-formatting branch November 2, 2026 00:40
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants