Skip to content

[mono][aot] AOT compiler output differs between runs with byte-identical inputs even with the deterministic option (differences beyond the AOTID), android-arm64 and android-x64 #135770

Open

Description

@jrramosdominguez

Description

Working towards reproducible Release builds of a .NET 10 MAUI Android app (OWASP MASWE-0075), I build one commit twice from a clean obj and compare every intermediate. With the Mono AOT compiler given the deterministic option (AndroidAotAdditionalArguments=deterministic), the 16-byte random AOTID is gone (before that option every one of the 210 images differed by exactly those 16 bytes), but a few libaot-*.dll.so images still differ from run to run by a small number of bytes, with byte-identical inputs.

aot-compiler.c (dotnet/runtime main, read 2026-10-14) uses aot_opts.deterministic in two places only: to skip generate_aotid and to skip the AOTID print. Nothing else in the compiler is covered by it.

What is identical across the two builds: the trimmed input assemblies for 103 of the 105 images (obj/.../android-arm64/linked/*.dll, cmp byte for byte; the two that differ are user assemblies whose differences are derived hashes only, and their images are not the ones listed below). nthreads is not passed, so compile_methods runs single-threaded; no dedup options; LLVM off; profiled AOT on.

Reproduction Steps

  1. dotnet new maui -n Repro targeting net10.0-android.
  2. dotnet publish -f net10.0-android -c Release -p:AndroidAotAdditionalArguments=deterministic -p:ContinuousIntegrationBuild=true.
  3. Keep obj/Release/net10.0-android/android-arm64/linked/*.dll and obj/Release/net10.0-android/android-arm64/aot/*.dll.so aside; delete bin and obj; publish again.
  4. Compare: the linked assemblies are byte-identical; some aot/*.dll.so are not (cmp -l).

Expected behavior

Identical input assemblies and identical options give identical AOT images.

Actual behavior

Measured on two clean builds of one commit (one pair; a second pair of the same commit gave a different set and counts):

  • android-arm64: System.Private.CoreLib.dll.so 95 bytes differ (116 and 96 in two other pairs), Microsoft.Maui.Controls.dll.so 2, Microsoft.Maui.Graphics.dll.so 8
  • android-x64: System.Private.CoreLib.dll.so 157, Microsoft.Maui.Controls.dll.so 451, Microsoft.Maui.Graphics.dll.so 589, Microsoft.Maui.dll.so 231, Microsoft.Maui.Essentials.dll.so 19

File sizes are identical; the differing bytes are scattered clusters of 2 to 12 bytes (CoreLib arm64: 16 clusters). They are content rather than padding: at one offset right after a ret (c0 03 5f d6), one build holds 12 00 00 00 48 01 00 00 05 00 00 00 and the other 00 00 00 14 a0 17 40 f9 00 00 00 94. The set of images that differ and the counts change from one pair of builds to the next.

Regression?

Unknown; not tested on earlier releases.

Known Workarounds

None found. deterministic removes the AOTID only.

Configuration

  • .NET SDK 10.0.303, workload set 10.0.302.1, Microsoft.Android.Sdk.Windows 36.1.69
  • Mono runtime pack Microsoft.NETCore.App.Runtime.Mono.android-arm64 10.0.10; cross compilers Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64 and ...android-x64 10.0.10
  • Host: Windows 11 x64; targets android-arm64 and android-x64
  • RunAOTCompilation true, AndroidEnableProfiledAot true, EnableLLVM unset, TrimMode partial (AndroidLinkMode SdkOnly), AndroidAotMode Normal
  • Trimmer: --deterministic (its default); ContinuousIntegrationBuild true

Other information

Is there an option I have missed that makes the remaining output stable (for example an ordering for extra or generic methods, or GOT slots)? I can run any diagnostic on request. A related report on the generated resource designer assembly's time stamp is on dotnet/android.

Activity

  1. added
    untriaged
    on Oct 14, 2026
  2. jrramosdominguez commented on Oct 14, 2026

    @jrramosdominguez
    Author

    The related dotnet/android report on the generated resource designer assembly's time stamp is dotnet/android#13140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Codegen-AOT-monountriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions