Skip to content

NativeAOT ILC: BadImageFormatException "Unknown file format" on android-x64 RuntimeTests #126117

@matouskozak

Description

@matouskozak

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1351537&view=results
Leg Name: android-x64 Release AllSubsets_NativeAOT_RuntimeTests

Error Details

ILC (NativeAOT IL Compiler) fails with System.BadImageFormatException: Unknown file format when compiling multiple NativeAOT SmokeTests on android-x64. Affects DynamicGenerics, UseSystemResourceKeys, X64Avx, UnitTests, Exceptions, X64Baseline, Preinitialization, and others (14+ projects).

System.BadImageFormatException: Unknown file format.
   at System.Reflection.PortableExecutable.PEHeaders..ctor(Stream peStream, Int32 size, Boolean isLoadedImage)
   at System.Reflection.PortableExecutable.PEReader.InitializePEHeaders()
   at ILCompiler.CompilerTypeSystemContext.AddModule(String filePath, String expectedSimpleName, Boolean useForBinding, ModuleData oldModuleData, Boolean throwOnFailureToLoad) in /_/src/coreclr/tools/Common/Compiler/CompilerTypeSystemContext.cs:line 198
   at ILCompiler.CompilerTypeSystemContext.GetModuleForSimpleName(String simpleName, Boolean throwIfNotFound) in /_/src/coreclr/tools/Common/Compiler/CompilerTypeSystemContext.cs:line 115
   at ILCompiler.Program.Run() in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 327

Error Message

{
    "ErrorMessage": [
        "System.BadImageFormatException: Unknown file format.",
        "ILCompiler.CompilerTypeSystemContext.AddModule"
    ],
    "BuildRetry": false,
    "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1351537
Error message validated: [System.BadImageFormatException: Unknown file format. ILCompiler.CompilerTypeSystemContext.AddModule]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 3/25/2026 7:24:06 PM UTC

Report

Build Definition Step Name Console log Pull Request
1351537 dotnet/runtime Build Tests Log

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 1 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions