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

NativeAOT doesn't work with app extensions #20653

Closed
rolfbjarne opened this issue May 27, 2024 · 1 comment
Closed

NativeAOT doesn't work with app extensions #20653

rolfbjarne opened this issue May 27, 2024 · 1 comment
Assignees
Projects
Milestone

Comments

@rolfbjarne
Copy link
Member

NativeAOT doesn't work with app extensions:

 System.Exception: No entrypoint module
     at ILCompiler.Program.Run() + 0x26bc
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass227_0.<.ctor>b__0(ParseResult result) + 0x304

from #19381 (comment).

We should try to make this happen.

It might require changes to NativeAOT if NativeAOT requires an entry point (since app extensions don't have an entry point).

@rolfbjarne rolfbjarne added this to the .NET 9 milestone May 27, 2024
@rolfbjarne rolfbjarne added this to NativeAOT in .NET 9 May 27, 2024
@ivanpovazan ivanpovazan self-assigned this May 27, 2024
dalexsoto pushed a commit that referenced this issue Jul 19, 2024
### Description

This PR enables building app extensions with NativeAOT. 

App extensions are class libraries and to build them with NativeAOT we
must not specify `CustomNativeMain=true`. If we do, ILC would expect
that the input assembly has a managed Main as the module entry point.

Additionally, when building class libraries (with the absence of a
managed Main entry point), our static reference from:

https://github.com/xamarin/xamarin-macios/blob/2e5ef1eb1c14e185b29bbef091d227ed0c8cc875/runtime/nativeaot-bridge.m#L39

requires build-time symbol resolution. To avoid linking errors, we
generate an empty `__managed__Main`
in the native bootstrapping code of the app extension (e.g., in
`main.arm64.mm`).

### Testing

The unit tests have been introduced to test building app extensions with
both Mono and NativeAOT.
Executing an iOS app TodayExtension built with NativeAOT has been
verified manually on an actual device.

--- 
Fixes: #20653
@ivanpovazan
Copy link
Contributor

Fixed in: 374e902

.NET 9 automation moved this from NativeAOT to Done Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants