-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix System.Text.Json source code annotation RequiresUnreferencedCodeAttribute by moving it to class level #67536
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionAs mentioned in this comment, there is a desire to revisit some source in the annotation in System.Text.Json namespace to hoist it to class level once issue is fixed. Its done now. Reproduction StepsNo observable behavioral change with the issue but only impacts code hygiene Expected behaviorRequiresUnreferencedCodeAttribute to be moved up to the class header Actual behaviorRequiresUnreferencedCodeAttribute is at many members in the class Regression?No Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsDescriptionAs mentioned in this comment, there is a desire to revisit some source in the annotation in System.Text.Json namespace to hoist it to class level once issue is fixed. Its done now. Reproduction StepsNo observable behavioral change with the issue but only impacts code hygiene Expected behaviorRequiresUnreferencedCodeAttribute to be moved up to the class header Actual behaviorRequiresUnreferencedCodeAttribute is at many members in the class Regression?No Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
I previously attempted making that change, but it turned out that adding RUC annotations on the type level introduced other complications, for example it was triggering linker warnings when consuming const or static members on that class even though it shouldn't. Keeping the annotations on the constructors should be fine until annotation issues have been ironed out, so I don't think we need to track this via an open issue. I'm going to close this. |
This is by design - putting the RUC on class means that everything about the class is dangerous. It is functionally equivalent to
If the class is only dangerous when instantiated, then you should put RUC on .ctors alone. |
Description
As mentioned in this comment, there is a desire to revisit some source in the annotation in System.Text.Json namespace to hoist it to class level once issue is fixed. Its done now.
Reproduction Steps
No observable behavioral change with the issue but only impacts code hygiene
Expected behavior
RequiresUnreferencedCodeAttribute to be moved up to the class header
Actual behavior
RequiresUnreferencedCodeAttribute is at many members in the class
Regression?
No
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: