Repository navigation
Fix W3CPropagatorcompliance against W3C Trace Context Level 2 - #129414
Merged
tarekgh merged 20 commits intoJun 17, 2026
Merged
Conversation
Validate the full tracestate list instead of returning only the valid prefix. Normalize optional whitespace around list members, discard invalid lists, and apply the Level 2 512-character combined length and 32-entry limits.
Enforce the total 256-character tracestate key limit while keeping at signs valid after the first character. Update W3CPropagator tests to match the corrected trace-context key grammar coverage.
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics-tracing |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates W3C Trace Context (traceparent/tracestate) handling to better align with the spec, including stricter tracestate validation and support for future-version traceparent extensions.
Changes:
- Normalize and validate
tracestateaccording to spec rules (OWS handling, entry count, key/value constraints) and return a canonicalized value. - Discard
tracestatewhentraceparentis invalid; trim future-versiontraceparentextension fields to the core length. - Expand and refine xUnit coverage for tracestate/traceparent edge-cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/libraries/System.Diagnostics.DiagnosticSource/tests/W3CPropagatorTests.cs | Adds/updates tests for tracestate whitespace, key rules, invalid-member behavior, and traceparent invalid/extension trimming behavior. |
| src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/W3CPropagator.cs | Reworks tracestate validation (limits, normalization) and adjusts traceparent extraction to discard tracestate on invalid parent and trim extension fields. |
Kielek
force-pushed
the
w3cpropagator-traceparent-complaiant
branch
from
June 15, 2026 10:12
8a37e24 to
561fea7
Compare
Open
3 tasks
tarekgh
reviewed
Jun 15, 2026
Member
|
CC @noahfalk |
Checking nulll is covered by other tests when the traceid is invalid
Member
|
/ba-g no real failure, just timeout. |
tarekgh
approved these changes
Jun 17, 2026
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
Fixes #129413 Does not bring strange behavior for key names described under w3c/trace-context#583. Technically it is not fully compliant with the officail tests suite, but also it does not bring any regression in this topic. I hope it will be addressed under W3C, if not, we can make a follow ups. If needed, I can add the full python suite here based on Kielek@9f88d19, but I think that existing C# coverage is more than enough. I have tried to made the commit granular, it might be easier to review it once by one, instead of all at once.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #129413
Does not bring strange behavior for key names described under w3c/trace-context#583. Technically it is not fully compliant with the officail tests suite, but also it does not bring any regression in this topic.
I hope it will be addressed under W3C, if not, we can make a follow ups.
If needed, I can add the full python suite here based on Kielek@9f88d19, but I think that existing C# coverage is more than enough.
I have tried to made the commit granular, it might be easier to review it once by one, instead of all at once.