Skip to content

Conversation

@MichalStrehovsky
Copy link
Member

Found on the NativeAOT side, since we're bug-for-bug compatible.

GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX would return DynamicallyAccessedMembers.None when the binding flags are null/unknown.

This fix is a bit more targeted so that we can potentially take it to 6.0.

In the existing linker code, there's some duality in how BindingFlags are handled - there are places that call BindingFlagsAreUnsupported and avoid GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX for null that way. Others call into this API without checking whether the flags are supported first.

I'm unclear whether it would be more appropriate to check for BindingFlagsAreUnsupported in the code I'm adding. It's a valid option as well.

` GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX` would return `DynamicallyAccessedMembers.None` when the binding flags are null/unknown.

This fix is a bit more targeted so that we can potentially take it to 6.0.

In general, there's some duality in how BindingFlags are handled - there are places that call `BindingFlagsAreUnsupported` and avoid `GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX` for null that way. Others call into this API without checking whether the flags are supported first.

I'm unclear whether it would be more appropriate to check for `BindingFlagsAreUnsupported` in the code I'm adding. It's a valid option as well.
@MichalStrehovsky MichalStrehovsky changed the title Fix handling of unknowns BindingFlags Fix handling of unknown BindingFlags Sep 21, 2021
@MichalStrehovsky MichalStrehovsky merged commit 108fe5b into dotnet:main Sep 21, 2021
@MichalStrehovsky MichalStrehovsky deleted the unknownBf branch September 21, 2021 23:45
agocke added a commit that referenced this pull request Oct 21, 2021
agocke added a commit to agocke/linker that referenced this pull request Oct 28, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
` GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX` would return `DynamicallyAccessedMembers.None` when the binding flags are null/unknown.

This fix is a bit more targeted so that we can potentially take it to 6.0.

In general, there's some duality in how BindingFlags are handled - there are places that call `BindingFlagsAreUnsupported` and avoid `GetDynamicallyAccessedMemberTypesFromBindingFlagsForXXX` for null that way. Others call into this API without checking whether the flags are supported first.

I'm unclear whether it would be more appropriate to check for `BindingFlagsAreUnsupported` in the code I'm adding. It's a valid option as well.

Commit migrated from dotnet/linker@108fe5b
agocke added a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
agocke added a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants