Skip to content

Invalid image produced by ilasm in .NET 9.0 #111189

Closed
@jkotas

Description

@jkotas

Repro

  1. Create a new C# console project
    mkdir C:\work\ilx64
    cd C:\work\ilx64
    dotnet new console

  2. Build and run the created project
    dotnet run

  3. Move to the output folder
    cd .\bin\Debug\net9.0\

  4. Verify that ilx64.dll exists
    dir ilx64.dll

  5. Decompile with ildasm
    C:\Users<username>.nuget\packages\runtime.win-x64.microsoft.netcore.ildasm\8.0.0\runtimes\win-x64\native\ildasm.exe /out:ilx64.il .\ilx64.dll

  6. Run /pe64 with ilasm version 8.0.0 Compile with /x64
    C:\Users<username>.nuget\packages\runtime.win-x64.microsoft.netcore.ilasm\8.0.0\runtimes\win-x64\native\ilasm.exe /pe64 /x64 /out:ilx64.dll ilx64.il

  7. Check operation ※Operates normally
    dotnet .\ilx64.dll

  8. Compile with /pe64 /x64 in version 9.0.0 of ilasm
    C:\Users<username>.nuget\packages\runtime.win-x64.microsoft.netcore.ilasm\9.0.0\runtimes\win-x64\native\ilasm.exe /pe64 /x64 /out:ilx64.dll ilx64.il

  9. Check operation ※BadImageFormatException occurs
    dotnet .\ilx64.dll

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions