Skip to content

[release/11.0] Fix System.Text.Json source-generated unsafe accessors - #133886

Merged
artl93 merged 1 commit into
release/11.0from
backport/pr-133599-to-release/11.0
Sep 15, 2026
Merged

artl93 merged 1 commit into
release/11.0from
backport/pr-133599-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Backport of #133599 to release/11.0

/cc @eiriktsarpalis

Customer Impact

  • Customer reported
  • Found internally

Address two closely related customer reported issues:

  1. Corner cases not accounted for in the newly introduced unsafe accessor support in the STJ source generator.
  2. STJ source generator codegen is incompatible with unsafe v2 semantics. Enabling unsafe v2 in projects using the source generator will frequently result in uncompilable code without possibility for workarounds.

Regression

  • Yes
  • No

#124650 introduced unsafe accessor suppor in .NET 11.

Testing

Added comprehensive testing covering the impacted corner cases. Enabled unsafe v2 in the STJ test projects to ensure it is being appropriately dogfed.

Risk

Medium. The fix involves nontrivial changes to the source generator emitter.

Fixes a number of codegen issues related to the source generator's
handling of newly introduced unsafe accessors. To be backported to .NET
11.

Fixes #133369. Fixes #133423. Fixes #133592.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2af8f83f-b01f-4ae3-b171-750c75bfde9e
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 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-text-json
See info in area-owners.md if you want to be subscribed.

@eiriktsarpalis eiriktsarpalis added this to the 11.0.0 milestone Sep 14, 2026
@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label Sep 14, 2026

@artl93 artl93 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regression. customer reported. approved.
Clean build analysis required before merge.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 14, 2026
@eiriktsarpalis

Copy link
Copy Markdown
Member

/ba-g test failures are unrelated.

@artl93
artl93 merged commit 43013f0 into release/11.0 Sep 15, 2026
101 of 107 checks passed
@artl93
artl93 deleted the backport/pr-133599-to-release/11.0 branch September 15, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Text.Json Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants