Suppress warnings in JSON source generated code#120181
Merged
stephentoub merged 1 commit intodotnet:mainfrom Sep 29, 2025
Merged
Suppress warnings in JSON source generated code#120181stephentoub merged 1 commit intodotnet:mainfrom
stephentoub merged 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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 |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
stephentoub
commented
Sep 29, 2025
...tem.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs
Show resolved
Hide resolved
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/18096646326 |
4 tasks
stephentoub
added a commit
that referenced
this pull request
Oct 8, 2025
This reverts commit d822325.
eiriktsarpalis
pushed a commit
that referenced
this pull request
Oct 8, 2025
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 #119451