-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Avoid looking for dynamically accessed members when none are requested. #90154
Avoid looking for dynamically accessed members when none are requested. #90154
Conversation
The purpose of this logic is to warn when no members can be found for a DynamicDependency attribute. However, it even warns when DynamicallyAccessedMemberTypes.None is specified in the attribute, which seems a bit overeager, so change the logic to not warn when DynamicallyAccessedMemberTypes.None is specified.
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar Issue DetailsThe purpose of this logic is to warn when no members can be found for a However, it even warns when DynamicallyAccessedMemberTypes.None is specified
|
Please add a test which validates the desired behavior. Curious: What's the scenario to have a |
I'm adding support to NativeAOT for |
Closing, we found an alternative solution that doesn't show any warnings. |
`None` seems to be equivalent to not having the attribute at all. The type will be stripped by ILLink and ILC. The `PublicConstructors | NonPublicConstructors` seems to be a better option to keep the type while making it possible to trim as much of its members as possible. This change resolves two warnings: ``` ILLink : warning IL2037: <Module>..cctor(): No members were resolved for 'None' on type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.FrameView'. ILC : warning IL2037: <Module>..cctor(): No members were resolved for '0' on type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.FrameView'. ``` (Note: these warnings will still be present for _static_ classes which don't have a static constructor) @rolfbjarne I believe we don't need dotnet/runtime#90154 anymore --------- Co-authored-by: Simon Rozsival <[email protected]>
The purpose of this logic is to warn when no members can be found for a
DynamicDependency attribute.
However, it even warns when DynamicallyAccessedMemberTypes.None is specified
in the attribute, which seems a bit overeager, so change the logic to not warn
when DynamicallyAccessedMemberTypes.None is specified (nor try to mark any
members, because we're not supposed to mark any members).