Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

System.BadImageFormatException: Invalid number of sections declared in PE header. #134

@jamescrosswell

Description

@jamescrosswell

Steps to reproduce

  1. Create a hello world command line application in dotnet
  2. Publish the application as a single file dotnet publish -c Release -p:PublishSingleFile=true
  3. Try to open the resulting executable in ILSpy... it won't let you (it only let's you open dlls)... but you can rename it to a dll and then open it (or run ilspycmd which let's you specify any file, regardless of the extension)

Error message shown

System.BadImageFormatException: Invalid number of sections declared in PE header.

image

Details

  • Tried with ILSpy for macOS arm64
  • Version ILSpy version 7.2.0.0.rc
  • ILSpy 7.2.1.6856 on Windows (obtained from the Microsoft Store) can open the same file without issue... It'd be great to know if there's a way to obtain that same version on macOS (I followed the links in the Readme.md file on this site to get the most recent build for Mac OS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions