Skip to content

Enable support for NativeAOT targeting iOS via opt-in feature #80905

Open

Description

@ivanpovazan

Overview

Supporting NativeAOT on iOS platforms as an experimental feature in .NET8 would enable our customers to try the NativeAOT toolchain and runtime with their iOS applications, in order to benefit from advantages mostly concentrated around application size savings and start-up performance.
In .NET8 the default toolchain and runtime when targeting iOS platforms will remain to be Mono, while NativeAOT would become available as an option.

This issues tracks progress on the identified work required for enabling NativeAOT on iOS platforms. The work is organised and tracked with GitHub issues divided by upcoming .NET8 preview releases in which they should become available. Some of the listed items can be considered as user stories and will require further break-down of work, while the others are plain tasks.

NOTE: The breakdown of GitHub issues does not impose hard deadlines. If some of the functionality does not get upstreamed for a particular preview version, this issue will be updated accordingly.

Tasks

.NET8 Preview 5

.NET8 Preview 6

.NET8 Preview 7

.NET8 GA

.NET9

.NET10

.NET11

Other relevant issues:


/cc: @marek-safar @SamMonoRT @steveisok @lambdageek @rolfbjarne @kotlarmilos @akoeplinger

Activity

  1. added this to the 8.0.0 milestone on Jan 20, 2023
  2. SamMonoRT commented on Jan 20, 2023

    @SamMonoRT
    Member
  3. AaronRobinsonMSFT commented on Jan 20, 2023

    @AaronRobinsonMSFT
    Member

    We should also have a note/item around diagnostics and document what the user experience will be on iOS. I believe it would be rather different and having a comprehensive list would help users make informed decisions about using NativeAOT and what to expect post deployment.

    /cc @tommcdon

  4. tommcdon commented on Jan 20, 2023

    @tommcdon
    Member

    Adding @thaystg @lateralusX. It is my understanding that Mono uses an in-proc debugger model due to mobile diagnostics restrictions.

  5. filipnavara commented on Jan 20, 2023

    @filipnavara
    Member

    We should also have a note/item around diagnostics and document what the user experience will be on iOS. I believe it would be rather different and having a comprehensive list would help users make informed decisions about using NativeAOT and what to expect post deployment.

    FWIW debugging with lldb on-device is possible, so in that sense it's comparable to the current model of debugging NativeAOT on Linux/macOS.

  6. ivanpovazan commented on Jan 23, 2023

    @ivanpovazan
    MemberAuthor

    @AaronRobinsonMSFT thank you for the suggestion. I have added it to the list.

  7. changed the title [-]NativeAOT on iOS as an experimental feature in .NET8 [/-] [+]Enable support for NativeAOT targeting iOS via opt-in feature[/+] on Jan 27, 2023
  8. curia-damiano commented on May 19, 2023

    @curia-damiano

    Does this feature mean that it will be possible to export a .NET class library as a native iOS library?

  9. 8 remaining items

  10. vitek-karas commented on Aug 22, 2024

    @vitek-karas
    Member

    Moving to 10 since all the remaining 9 tasks are documentation and are tracked by separate issues.

  11. modified the milestones: 9.0.0, 10.0.0 on Aug 22, 2024
  12. AlexeiNaabal commented on Sep 4, 2024

    @AlexeiNaabal

    Does this feature mean that it will be possible to export a .NET class library as a native iOS library?

    Thank you for the question @curia-damiano. In theory that would work as well, however, our current focus with NativeAOT is supporting full iOS applications.

    Would you mind sharing what would be the use case that you have in mind for native iOS libraries?

    Could you please provide more information @ivanpovazan? We are now testing publish managed class to native library, only find out we have to enable self-contained. Maybe the after-procedural (like library builder) is ready, but the publish itself is not? when we set <NativeLib>Shared</NativeLib>, the compiler force us to enable self-contained.

    Background: We already setup an embed mono runtime, thus self-contained is not suitable for our need :) Recently we are experimenting if we can extract certain managed class as native library for the native host to invoke, to see if it can improve performance.

  13. pavelsavara commented on Sep 4, 2024

    @pavelsavara
    Member

    We are now testing publish managed class to native library, only find out we have to enable self-contained.
    when we set <NativeLib>Shared</NativeLib>, the compiler force us to enable self-contained.

    This touches on our rooting/trimming WASM use-case #101434

  14. curia-damiano commented on Sep 4, 2024

    @curia-damiano

    As I see that this issue is not closed yet, I would like to ask this:

    • the Swift SDK for Application Insights has been deprected less than a couple of years ago
    • with perfect timing, we retire App Center
    • the idea would be to use the .NET SDK for Application Insights in a native iOS library developed in Swift, compiling the SDK to a native library (eventually adding some entry point methods).

    Do you think that this is possible with .NET 8? And if not, will it be possible in .NET 9?

  15. lemonmojo commented on Sep 4, 2024

    @lemonmojo

    @curia-damiano Sounds like the perfect use case for Beyond.NET. That being said, I would obviously very much appreciate if that was built in to .NET.

  16. curia-damiano commented on Sep 4, 2024

    @curia-damiano

    I was not aware of it, thank you very much @lemonmojo for telling me!

  17. ivanpovazan commented on Sep 4, 2024

    @ivanpovazan
    MemberAuthor

    @AlexeiNaabal

    Could you please provide more information @ivanpovazan? We are now testing publish managed class to native library, only find out we have to enable self-contained. Maybe the after-procedural (like library builder) is ready, but the publish itself is not? when we set Shared, the compiler force us to enable self-contained.

    This is by design. Building a managed library into a shared native one embeds the runtime with it.

    Background: We already setup an embed mono runtime, thus self-contained is not suitable for our need :) Recently we are experimenting if we can extract certain managed class as native library for the native host to invoke, to see if it can improve performance.

    If I understand your setup correctly, you would have mono and NativeAOT runtime running in the same process, which is not a setup that is supported.


    @curia-damiano

    • the idea would be to use the .NET SDK for Application Insights in a native iOS library developed in Swift, compiling the SDK to a native library (eventually adding some entry point methods).

    Do you think that this is possible with .NET 8? And if not, will it be possible in .NET 9?

    /cc: @kotlarmilos ^

  18. modified the milestones: 10.0.0, 11.0.0 on Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

EpicGroups multiple user stories. Can be grouped under a theme.area-NativeAOT-coreclros-iosApple iOStrackingThis issue is tracking the completion of other related issues.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions