## Executive Summary

In this milestone presentation, **Jonathan Peppers** details the engineering journey of replacing the legacy Mono runtime with **CoreCLR** as the default, unified execution engine for **.NET MAUI, Android, iOS, and Mac Catalyst** in **.NET 11**.

Historically, mobile .NET ran in a "parallel universe" originating from Xamarin and the open-source Mono project (dating back to its first git commit in 2001). Mono maintained its own base class libraries, bespoke embedding APIs, custom debuggers, and unique ahead-of-time (AOT) toolchains. In .NET 11, mobile achieves 100% convergence with the rest of .NET:
- **CoreCLR Default Everywhere:** Beginning in .NET 11 Preview 4, CoreCLR became the default runtime for Android and iOS; in Preview 6, Mono targeting was permanently retired.
- **Enterprise Diagnostics & Tooling Parity:** Mobile apps gain the battle-tested diagnostics of cloud servers and desktop runtimes—EventPipe, `.NET Trace`, Memory Profilers, and standardized stack traces.
- **ReadyToRun & Profiled Startup:** Replacing `mono-aot-cross` with `crossgen2` ReadyToRun (R2R). By default, Android leverages **Partial ReadyToRun** driven by `.mibc` startup execution profiles, achieving sub-second cold starts on budget devices while preserving compact APK download footprints.
- **Native AOT on Mobile:** Advancing Native AOT into public preview for Android and iOS, emitting a single standalone `.so` or Mach-O binary with zero JIT overhead.
- **Verified Benchmark Results:** Benchmarked on $200 budget hardware (Samsung Galaxy A16) across the default MAUI template, rich component suites (Syncfusion & Community Toolkit), and real-world production apps (**M365 Admin**), delivering significant startup acceleration without bloating application size.

---

## Mobile Runtime Architecture & Startup Lifecycle

CoreCLR initializes seamlessly beneath native mobile operating system life cycles before application UI components are created:

```mermaid
flowchart TD
    subgraph OSBoot ["Operating System Application Launch"]
        OSIntent["Android Launcher / iOS Launchd"]
        ContentProv["Android ContentProvider / iOS Main Hook<br/>(Early Pre-Application Stage)"]
    end

    subgraph RuntimeBoot ["CoreCLR Mobile Bootstrap"]
        StoreLoad["Read libassemblystore.so Data Section<br/>(Split-APK Compressed IL + R2R Images)"]
        Init["Invoke coreclr_initialize()<br/>(Thin C-ABI Bootstrap, No Legacy Mono APIs)"]
        GCInit["Start CoreCLR GC & EventPipe Engine"]
    end

    subgraph ExecutionModes ["Code Execution Pipelines"]
        ModeCheck{"Mobile OS & Architecture"}
        AndroidJIT["Android: Partial ReadyToRun (Default)<br/><b>Startup methods compiled via .mibc profile;<br/>JIT compiles rest on demand</b>"]
        FullR2R["Full ReadyToRun (Opt-In)<br/><b>Everything pre-compiled via crossgen2</b>"]
        iOSNoJIT["iOS / iPadOS: No Writable RAM (No JIT)<br/><b>Full AOT Pre-compiled Mach-O + Interpreter</b>"]
        NativeAOT["Native AOT (Preview)<br/><b>Single static binary (.so / Mach-O), aggressive trimming</b>"]
    end

    subgraph AppEntry ["Application Execution"]
        AppCreate["Application.OnCreate()"]
        ActivityCreate["MainActivity / UIViewController.OnCreate()"]
        MAUIRender["Render Visual Tree & XAML Shell"]
    end

    OSIntent --> ContentProv --> StoreLoad --> Init --> GCInit --> ModeCheck
    ModeCheck -- "Android (Default)" --> AndroidJIT --> AppCreate
    ModeCheck -- "Android (Opt-In)" --> FullR2R --> AppCreate
    ModeCheck -- "Apple iOS" --> iOSNoJIT --> AppCreate
    ModeCheck -- "Native AOT" --> NativeAOT --> AppCreate
    AppCreate --> ActivityCreate --> MAUIRender
```

---

## Key Technical Innovations

### 1. The 25-Year Journey: From Mono to CoreCLR

- **2001:** First commit of the Mono project (visible in the Git history of `dotnet/runtime`).
- **2016:** Microsoft acquires Xamarin.
- **2020:** Mono source code merged into `dotnet/runtime` under `/src/mono`.
- **.NET 6 (2021):** .NET MAUI launched, unifying project files and base class libraries while continuing to run Mono under the hood.
- **.NET 10 (2025):** CoreCLR mobile preview introduced via opt-in `<UseMonoRuntime>false</UseMonoRuntime>`.
- **.NET 11 (2026):** CoreCLR becomes the default in Preview 4; Mono targeting permanently removed in Preview 6.

![Session Introduction](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/01-session-intro.webp)
*Jonathan Peppers introduces .NET MAUI's transition to CoreCLR at .NET Conf 2026.*

![Why CoreCLR Agenda](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/02-why-coreclr-agenda.webp)
*Session roadmap: Why CoreCLR, startup lifecycle, ReadyToRun, Native AOT, and benchmarks.*

![Xamarin to .NET MAUI Evolution](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/03-xamarin-to-maui-stack.webp)
*Comparing the legacy parallel Xamarin stack with unified .NET MAUI.*

![Mono 2001 Git Commit](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/04-mono-2001-commit.webp)
*Historical first commit of Mono from 2001 preserved in the dotnet/runtime repository.*

![CoreCLR Default in .NET 11](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/05-coreclr-default-preview.webp)
*CoreCLR made default in Preview 4; Mono targeting permanently removed in Preview 6.*

---

### 2. Startup Lifecycle & Bootstrap Simplification

#### Android ContentProvider Bootstrapping
Mobile operating systems enforce strict application lifecycles. On Android, CoreCLR initializes via a dedicated .NET runtime `ContentProvider`. This runs before Android's `Application.OnCreate()` or `Activity.OnCreate()`, booting the CLR transparently so managed code is fully operational when the first user lifecycle method is invoked.

#### Retirement of Mono Embedding APIs
In Mono, host applications and C++ game engines interacted with managed code using hundreds of complex Mono embedding APIs (`mono_domain_get`, `mono_assembly_open`, etc.).
- CoreCLR simplifies this into a minimal entrypoint: `coreclr_initialize()`.
- Unmanaged native callers invoke managed code through standardized, high-performance C-ABI exports decorated with `[UnmanagedCallersOnly]`.

#### Assembly Packaging (`libassemblystore.so`)
To comply with Google Play dynamic delivery and split-APK architectures, managed assemblies (`.dll` files) are compressed into the data section of a single native library named `libassemblystore.so`. The native CoreCLR loader uncompresses assemblies on demand per architecture.

![Android ContentProvider](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/06-android-content-provider.webp)
*CoreCLR initializing within an Android ContentProvider before Application.OnCreate.*

![Diagnostics and Debugging Benefits](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/07-benefits-diagnostics.webp)
*Diagnostics parity: server-grade EventPipe, .NET Trace, and unified stack traces.*

![Mono Embedding vs CoreCLR Initialize](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/08-mono-embedding-vs-coreclr.webp)
*Replacing verbose Mono embedding APIs with the lean coreclr_initialize entrypoint.*

![Assembly Store Packaging](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/09-assembly-store-packaging.webp)
*Packaging managed DLLs inside libassemblystore.so for Google Play split-APK delivery.*

---

### 3. Compilation Modes: ReadyToRun vs. Native AOT

Jonathan clarifies the distinctions between compilation models on mobile:

| Dimension | Mono AOT (`mono-aot-cross`) | CoreCLR ReadyToRun (`crossgen2`) | Native AOT (`PublishAot`) |
|---|---|---|---|
| **Compilation Tool** | `mono-aot-cross` | `crossgen2` | Native AOT Trimmer/ILC |
| **Output Format** | Separate `.so` per DLL | Embedded native image inside `.dll` | Single standalone `.so` or Mach-O |
| **JIT Requirement** | Mixed JIT/AOT | JIT fallback available | Zero JIT (No dynamic codegen) |
| **Trimming Requirements** | Tolerant of reflection | Tolerant of reflection | Strict static analysis (Trimmer-safe) |
| **Target Platform** | Legacy Android/iOS | Android (Partial R2R default) | Android (Preview), iOS (Preview) |

#### Partial ReadyToRun (Default on Android)
Pre-compiling every method with Full ReadyToRun increases APK download size. Android defaults to **Partial ReadyToRun**:
- A representative MAUI startup session is recorded into an `.mibc` execution profile.
- `crossgen2` pre-compiles only the critical startup methods into native machine code.
- Non-startup methods remain pure IL and are compiled on demand by the JIT as the user navigates, giving developers the fastest startup with minimal APK bloat.

#### iOS Constraints
Apple's iOS prohibits executing writable memory pages, preventing JIT execution. CoreCLR on iOS pre-compiles code ahead of time with interpreter fallback for dynamic expressions.

![ReadyToRun vs Mono AOT](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/10-readytorun-vs-monoaot.webp)
*Comparing crossgen2 ReadyToRun against legacy Mono AOT Cross.*

![Partial ReadyToRun Profiled Startup](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/11-partial-readytorun-profiled.webp)
*Profiled Partial ReadyToRun compiling startup paths via .mibc profiles.*

![Native AOT on Mobile Concept](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/12-native-aot-concept.webp)
*Native AOT generating a single monolithic binary without JIT or dynamic assembly loading.*

![System.Text.Json Trimming and Source Generators](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/13-stj-source-gen-trimming.webp)
*Authoring trimmer-safe code using System.Text.Json source generators for Native AOT.*

---

### 4. Real-World Performance & Benchmark Results

Jonathan presents performance data captured on a **Samsung Galaxy A16** (a representative $200 budget device) and modern iOS devices across three test applications:
1. **Default MAUI Template:** Baseline single-page app.
2. **MAUI Sample Content:** Complex app featuring Syncfusion charts, data grids, and the MAUI Community Toolkit.
3. **M365 Admin:** A production enterprise mobile app built by Microsoft.

#### Startup Time
- On Android, **Partial ReadyToRun on CoreCLR outperforms Mono across all apps**, providing noticeable responsiveness gains on budget devices.
- On iOS, CoreCLR delivers faster startup across all tested configurations.

#### Package & APK Size
- **Partial ReadyToRun** keeps Android APK size nearly identical to legacy Mono AOT.
- Full ReadyToRun produces ~10–15% larger binaries but is available as an opt-in toggle (`<PublishReadyToRun>true</PublishReadyToRun>`) for teams prioritizing absolute cold-start velocity.
- On iOS, overall package size decreased across all apps under CoreCLR.

![Android Startup Benchmarks](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/14-android-startup-benchmarks.webp)
*Samsung Galaxy A16 startup benchmarks comparing Mono, Partial R2R, and Full R2R.*

![APK Size and iOS Benchmarks](/dotnetconf2026/archive/36-bringing-coreclr-to-maui-mobile/screenshots/15-apk-size-and-ios-benchmarks.webp)
*APK size trade-offs and iOS startup/package improvements under CoreCLR.*

---

## Migration Checklist for Developers

Jonathan emphasizes that the migration to CoreCLR is designed to be frictionless, but recommends three verification steps:

1. **Retarget to `net11.0`:** Changing target frameworks automatically activates CoreCLR. No code changes are required for standard MAUI apps.
2. **Review Custom Native Embeddings:** If an app or native library relied on legacy `mono_*` C APIs, migrate to `[UnmanagedCallersOnly]` entrypoints or explore Native AOT.
3. **Run Existing Test Suites on Device:** Verify edge-case reflection and formatting behavior. Note that crash logs and exception stack traces will reflect CoreCLR's standardized formatting.

---

## Conclusion

The arrival of **CoreCLR on .NET MAUI in .NET 11** completes the decadelong mission to unify .NET. Mobile developers now run the exact same runtime engine that powers mission-critical Azure cloud infrastructure and high-performance desktop applications. With **Partial ReadyToRun**, **unified diagnostics**, and **Native AOT on the horizon**, .NET 11 marks the fastest, most cohesive mobile era yet.
