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

Set the IsDynamicCodeSupported feature to false when using FullAOT #18340

Closed
Tracked by #87924
rolfbjarne opened this issue May 25, 2023 · 4 comments
Closed
Tracked by #87924

Set the IsDynamicCodeSupported feature to false when using FullAOT #18340

rolfbjarne opened this issue May 25, 2023 · 4 comments
Assignees
Labels
app-size enhancement The issue or pull request is an enhancement
Milestone

Comments

@rolfbjarne
Copy link
Member

We need to set the System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported feature to false when using FullAOT (i.e. AOT + no interpreter).

This is done by setting the DynamicCodeSupport property to false:

https://github.com/dotnet/sdk/blob/9ca8336afab6247a22e745c2de4960e9b660d164/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L529-L532

The NativeAOT compiler does that here:

https://github.com/dotnet/sdk/blob/9ca8336afab6247a22e745c2de4960e9b660d164/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L27

We need to do the same when using MonoAOT + no interpreter.

@rolfbjarne rolfbjarne added enhancement The issue or pull request is an enhancement app-size labels May 25, 2023
@rolfbjarne rolfbjarne added this to the .NET 8 milestone May 25, 2023
@ivanpovazan
Copy link
Contributor

I can look into this.

@ivanpovazan
Copy link
Contributor

As the dotnet/runtime side has been merged in, we should try it out on xamarin .net8 branch once we start referencing the version including the change via something like:

<DynamicCodeSupport Condition="'$(DynamicCodeSupport)' == '' and '$(UseInterpreter)' != 'true'">false</DynamicCodeSupport>

@ivanpovazan
Copy link
Contributor

ivanpovazan commented Jul 11, 2023

When: dotnet/runtime#88539 gets merged in, it should additionally bring some size savings as more code will depend on the feature switch in question.

UPDATE: The change is included in Microsoft.NETCore.App.Runtime.Mono.ios-arm64 version 8.0.0-preview.7.23361.9

@ivanpovazan
Copy link
Contributor

ivanpovazan commented Aug 7, 2023

Fixed by 0c0e5d7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-size enhancement The issue or pull request is an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants