Android framework version
net11.0-android (Preview)
Affected platform version
.NET 11
Description
Context:
When we added ReadyToRun support for Android (CoreCLR), R2R images remain inside .dll files. There was a step where this data was copied to memory and loaded, which may not be optimal.
For CoreCLR (R2R) support on iOS, there was "Platform-Native R2R Envelope" related work — tracked by issue dotnet/runtime#120065. On iOS, PE-based R2R can't work due to page protection restrictions (no JIT entitlement), so R2R native code is emitted into a separate Mach-O (.dylib) file that the OS can load natively.
Key PRs:
| PR |
Title |
Author |
Date |
| #120584 |
Add initial doc for R2R platform-native image (Mach-O, composite only) |
elinor-fung |
Oct 2025 |
| #120777 |
Extract out minimal concerns from PEImageLayout for R2R images |
jkoritzinsky |
Nov 2025 |
| #121186 |
Add support for emitting Mach-O R2R images |
jkoritzinsky |
Nov 2025 |
| #121363 |
Add support for host callback to get information for platform-native composite R2R images |
elinor-fung |
Nov 2025 |
| #122511 |
Reduce the number of sections in R2R PE files |
jkoritzinsky |
Jan 2026 |
The integration on the macios side was dotnet/macios#24327, which got a MAUI iOS app running with R2R.
The design doc (readytorun-platform-native-envelope.md) lays out the approach: crossgen2 emits the composite R2R image as a native Mach-O .dylib, and a new get_native_code_data host callback tells the runtime where to find it. This lets the OS dlopen the native code directly rather than needing to copy/map PE data.
Question
Is there anything we can use from this work to improve Android?
Steps to Reproduce
dotnet new android
dotnet build -c Release uses ReadyToRun by default
Android framework version
net11.0-android (Preview)
Affected platform version
.NET 11
Description
Context:
When we added ReadyToRun support for Android (CoreCLR), R2R images remain inside
.dllfiles. There was a step where this data was copied to memory and loaded, which may not be optimal.For CoreCLR (R2R) support on iOS, there was "Platform-Native R2R Envelope" related work — tracked by issue dotnet/runtime#120065. On iOS, PE-based R2R can't work due to page protection restrictions (no JIT entitlement), so R2R native code is emitted into a separate Mach-O (.dylib) file that the OS can load natively.
Key PRs:
The integration on the macios side was dotnet/macios#24327, which got a MAUI iOS app running with R2R.
The design doc (readytorun-platform-native-envelope.md) lays out the approach: crossgen2 emits the composite R2R image as a native Mach-O
.dylib, and a newget_native_code_datahost callback tells the runtime where to find it. This lets the OSdlopenthe native code directly rather than needing to copy/map PE data.Question
Is there anything we can use from this work to improve Android?
Steps to Reproduce
dotnet new androiddotnet build -c Releaseuses ReadyToRun by default