Skip to content

Conversation

@stephentoub
Copy link
Member

Fixes #119451

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue #119451 by suppressing warnings in JSON source generated code. The change addresses warnings that can occur when using experimental or obsolete members in types that are processed by the JSON source generator.

Key changes:

  • Added comprehensive warning suppression in release builds while maintaining selective suppression in debug builds
  • Added test coverage for experimental member scenarios to ensure warnings are properly suppressed

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
JsonSourceGenerator.Emitter.cs Modified warning suppression logic to disable all warnings in release builds while keeping targeted suppression in debug builds
CompilationHelper.cs Added ExperimentalAttribute definition for testing experimental member scenarios
JsonSourceGeneratorTests.cs Added test case to verify no warnings are generated when using experimental members

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

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

Thanks

@stephentoub stephentoub merged commit d822325 into dotnet:main Sep 29, 2025
89 checks passed
@stephentoub stephentoub deleted the suppressjson branch September 29, 2025 12:16
@stephentoub
Copy link
Member Author

/backport to release/10.0

@github-actions
Copy link
Contributor

Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/18096646326

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.

[Experimental], JSON polymorphism, and the JSON source generator don't play well together

2 participants