-
Notifications
You must be signed in to change notification settings - Fork 776
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
Improve JsonSchemaExporter trimmer safety. #5591
Improve JsonSchemaExporter trimmer safety. #5591
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.
I think the current changes look better than what we had before. I think there is something that can be done in the future about that DynamicallyAccessedMemberTypes.All
reference. But that shouldn't block this PR.
I see there are still 3 UnconditionalSuppressMessage
attributes in this file.
The 2 regarding NullableAttribute
and NullableContextAttribute
don't look correct to me. The AOT compiler could trim the field metadata for these types, in theory. Maybe it would be better to use GetCustomAttributesData
instead.
For the one regarding GetGenericMemberDefinition
, I think we could use GetMemberWithSameMetadataDefinitionAs
to remove the suppression.
It would be better to use |
… schema generation. (#109424) * Add annotations and regression testing for members accessed by legacy schema generation. * Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs * Incorporate feedback from dotnet/extensions#5591
* Improve JsonSchemaExporter trimmer safety. * Remove var * Address feedback. * Remove DynamicallyAccessedMemberTypes.All * Extract reflection helpers into separate file and remove a number of warning suppressions. * Re-enable failing tests that were patched in .NET 9
Improves the private reflection code used by the
JsonSchemaExporter
polyfill so that trimmer safety is improved.Microsoft Reviewers: Open in CodeFlow