Skip to content
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 NativeAOT warnings #73

Merged
merged 1 commit into from May 2, 2023
Merged

Conversation

eerhardt
Copy link
Contributor

  • Check IsDynamicCodeSupported in Delegates.GetGetter before trying to create a DynamicMethod
  • Check IsDynamicCodeSupported in PerTypeHelpers before trying to MakeGenericType, which can fail for value types in NativeAOT.

Fix #72

cc @mgravell

- Check IsDynamicCodeSupported in Delegates.GetGetter before trying to create a DynamicMethod
- Check IsDynamicCodeSupported in PerTypeHelpers before trying to MakeGenericType, which can fail for value types in NativeAOT.

Fix mgravell#72
#if NETCOREAPP3_0_OR_GREATER
&& RuntimeFeature.IsDynamicCodeSupported
#endif
)
{
try
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH: I'm not sure what the code in the try is doing.

  1. Why isn't it returning the result of the Reflection?
  2. If we just want to return UnmanagedAllocator<T>.Shared, why not just return UnmanagedAllocator<T>.Shared;?

I was half of the mind to just delete this code, since it doesn't appear to work, and doesn't appear to have any unit tests that test ArenaFlags.PreferUnmanaged and ArenaFlags.PreferPinned. But the current proposal won't change any behavior on normal CoreCLR and it gets rid of the warning on Native AOT.

@mgravell mgravell merged commit 87b2ce1 into mgravell:main May 2, 2023
@eerhardt eerhardt deleted the FixAotWarnings branch May 2, 2023 15:32
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.

Trim and AOT warnings in Delegates and PerTypeHelpers
2 participants