-
Couldn't load subscription status.
- Fork 5.2k
Suppress warnings in JSON source generated code #120181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 |
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
...tem.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/18096646326 |
This reverts commit d822325.
Fixes #119451