Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dotnet/android
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fbe3d99
Choose a base ref
...
head repository: dotnet/android
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b367d98
Choose a head ref
  • 3 commits
  • 33 files changed
  • 2 contributors

Commits on Jul 16, 2026

  1. [NativeAOT] Make the trimmable typemap the default (#12121)

    ## Goal
    
    Make the trimmable typemap the **default** typemap for NativeAOT.
    
    **Supersedes #11822.** That PR was based directly on `main`; this one is instead **stacked on #12030** (`dev/simonrozsival/android-trimmable-revisit-arrays-generic-collections`), which reworks the AOT-safe array and collection factories. Rebasing onto #12030 let me **drop the array-proxy / boxed-nullable / `System.String`-array-element commits** (now handled by #12030's `MakeArrayType`/`MakeGenericType` factories) plus other work that has since landed on that branch, leaving just the focused NativeAOT default flip and its test adjustments.
    
    > **Scope:** for now this only **changes the default**. The existing `managed`/`llvm-ir` configurations remain reachable on NativeAOT (the runtime keeps its `ManagedTypeManager` / `JavaMarshalValueManager` fallbacks). Removing the non-trimmable NativeAOT paths and adding a hard error will be done in a **separate PR**.
    
    Contributes to #10794, #11012, #8724, #10788, #10793.
    
    ## Change map
    
    ### Core enablement
    - **`Microsoft.Android.Sdk.NativeAOT.targets`** — default `_AndroidTypeMapImplementation` `managed` → `trimmable`.
    - **`Xamarin.Android.Common.targets`** — run the post-ILLink `AssemblyModifierPipeline` for NativeAOT+trimmable; skip the project proguard config for NativeAOT+trimmable. (All gated on `trimmable`, so `managed`/`llvm-ir` NativeAOT is unchanged.)
    - **`Microsoft.Android.Sdk.TypeMap.Trimmable.targets`** — disable `ManagedPeerNativeRegistration` for trimmable.
    - Pass generated ACW keep rules to R8 on the trimmable path; keep `_PreTrimmingFixLegacyDesignerUpdateItems` off the trimmable path.
    
    ### Tests
    - `BaseTest` — `IgnoreNativeAotLinkedAssemblyChecks` / `IgnoreOnNativeAot` helpers.
    - Skip guards for NativeAOT cases that inspect illink's `linked/` output (`LinkerTests`, `IncrementalBuildTest`, `BuildTest2`); delete the obsolete `BuildTest2.NativeAOT` typemap test.
    - Warning-clean updates now that the trimmable default no longer emits the reflection-manager IL3050/IL3053 warnings.
    - `DotNetBuild` expects `mapping.txt` for NativeAOT release; add a NativeAOT regression test for R8-kept runtime ACWs.
    - The `XA4212` custom-`IJavaObject` diagnostic is skipped on the NativeAOT (trimmable) path here for simplicity; the root-cause fix that emits it from the trimmable generator moved to follow-up **#12132**.
    
    ## Local validation
    
    - `Microsoft.Android.Sdk.TrimmableTypeMap.Tests` → **614 pass**.
    - Full device/CI matrix + apkdesc/size baselines deferred to this PR's CI run.
    
    ## Follow-up
    
    - **#12132** — [NativeAOT] Emit XA4212 for custom IJavaObject types on the trimmable path. Adds the custom-`IJavaObject` detection to the trimmable typemap generator and re-enables the test skipped here.
    simonrozsival authored Jul 16, 2026
    Configuration menu
    Copy the full SHA
    77706d7 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2026

  1. [coreclr] Add crash report build property (#12136)

    Add an `EnableCrashReport` MSBuild property that writes `DOTNET_EnableCrashReport=1` into the generated Android environment file for CoreCLR and NativeAOT applications. This allows crash reporting to be enabled before runtime startup.
    
    Extend the environment-file tests to cover enabled and disabled values for CoreCLR, and document the property.
    
    Android side of: dotnet/macios#26130
    
    Tests were not run because the local .NET for Android SDK is not built in this worktree.
    jonathanpeppers authored Jul 17, 2026
    Configuration menu
    Copy the full SHA
    143d5fb View commit details
    Browse the repository at this point in the history
  2. [CoreCLR] On-device decompressed AssemblyStore cache (#11967)

    Builds on the Zstd AssemblyStore compression introduced by #11730. This prototype caches decompressed assemblies on-device so subsequent launches can skip Zstd decompression and use clean, file-backed mappings instead of dirty anonymous memory.
    
    ## Design
    
    - Enable with `AndroidEnableAssemblyStoreDecompressionCache=true` in a CoreCLR Release build. The default is `false`.
    - Cache entries live under `<codeCacheDir>/decompressed-assembly-cache-v1/<store-content-id>/<descriptor-index>.bin`.
    - Assembly-store format v4 carries a deterministic 64-bit content ID, so cache lookup does not need to hash compressed payloads on every launch.
    - Numeric descriptor keys avoid path traversal, filename limits, and satellite-assembly names such as `fr/App.resources.dll`.
    - Each entry contains the decompressed payload plus a footer with cache magic/version, store ID, descriptor index, payload size, and a CRC32 payload checksum.
    - Cache hits use `mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE)` so runtime writes become COW while untouched pages remain clean and file-backed.
    - Cache misses take an immutable snapshot before exposing the shared decompression buffer to the runtime.
    - A detached worker drains the queue and exits. Queued snapshots are capped at 32 MiB; additional entries are skipped rather than delaying startup or growing memory without bound.
    - Persistence writes each entry to a per-process unique temp file (`<descriptor-index>.bin.tmp.<pid>`) followed by atomic `rename`, so concurrent processes cannot clobber a shared temp file. Stale `.tmp.*` staging files left by a writer that Android killed before `rename` are swept when the store cache directory is initialized, so they cannot accumulate across startups. The cache is intentionally disposable: it does not `fsync`; incomplete or power-loss-damaged entries fail checksum validation and fall back to decompression.
    - Storage failures disable further writes for that process, while reads and normal assembly loading continue.
    - `debug.net.asmcache=0|1` remains available as an internal A/B override; `XA_DISABLE_ASSEMBLY_CACHE` forces it off.
    
    Android deletes `codeCacheDir` contents on app and platform updates. The store content ID, cache format version, exact-size checks, and payload checksum provide additional invalidation and corruption protection.
    
    ## Coverage
    
    - Assembly-store generation verifies the v4 header and content ID.
    - Application-config generation verifies the MSBuild opt-in is emitted for CoreCLR.
    - A device integration test launches a Release app, waits for persisted entries, corrupts one entry, relaunches successfully, and verifies the corrupted entry is rejected and rewritten with valid contents while cached assemblies remain file-mapped.
    - The native Release solution builds the cache path for all supported Android ABIs.
    
    ## Performance status
    
    The earlier prototype measured a small warm-launch improvement on a Samsung Galaxy A16:
    
    | app | warm OFF | warm ON | delta |
    | --- | ---: | ---: | ---: |
    | blank MAUI | 1062.8 ms | 1035.0 ms | -27.8 ms |
    | MAUI sample content | 2205.6 ms | 2156.6 ms | -49.0 ms |
    
    Those numbers predate the payload-integrity scan, bounded writer, and new cache format, so they must be re-measured. The expected stronger justification remains memory composition rather than latency: dirty/private PSS should move toward clean file-backed pages, but that has not yet been quantified.
    
    Before considering a default-on product feature, measure:
    
    - dirty, clean, and total PSS after first render and on subsequent launches;
    - first-launch peak RSS, bytes written, worker completion time, and energy;
    - cache storage footprint and launch break-even;
    - low-, mid-, and high-end devices, including 32-bit where supported;
    - direct LZ4 versus Zstd comparisons under identical packaging settings.
    simonrozsival authored Jul 17, 2026
    Configuration menu
    Copy the full SHA
    b367d98 View commit details
    Browse the repository at this point in the history
Loading