ILSpy icon indicating copy to clipboard operation
ILSpy copied to clipboard

[ILSpyCmd] IlSpy can open, but IlSpyCmd gives "PE file does not contain any managed metadata"

Open NBKRedSpy opened this issue 2 years ago • 2 comments

Steps to reproduce

  1. Run "ilspycmd ModLoaderInstaller-win32.exe_Beware_AutoUpdates.bak" on attached file.

Error message shown

ICSharpCode.Decompiler.Metadata.PEFileNotSupportedException: PE file does not contain any managed metadata.
   at ICSharpCode.Decompiler.Metadata.PEFile..ctor(String fileName, PEReader reader, MetadataReaderOptions metadataOptions) in /_/ICSharpCode.Decompiler/Metadata/PEFile.cs:line 70
   at ICSharpCode.ILSpyCmd.ILSpyCmdProgram.GetDecompiler(String assemblyFileName) in D:\a\ILSpy\ILSpy\ICSharpCode.ILSpyCmd\IlspyCmdProgram.cs:line 273
   at ICSharpCode.ILSpyCmd.ILSpyCmdProgram.Decompile(String assemblyFileName, TextWriter output, String typeName) in D:\a\ILSpy\ILSpy\ICSharpCode.ILSpyCmd\IlspyCmdProgram.cs:line 324
   at ICSharpCode.ILSpyCmd.ILSpyCmdProgram.<OnExecuteAsync>g__PerformPerFileAction|53_0(String fileName, <>c__DisplayClass53_0& ) in D:\a\ILSpy\ILSpy\ICSharpCode.ILSpyCmd\IlspyCmdProgram.cs:line 245
   at ICSharpCode.ILSpyCmd.ILSpyCmdProgram.OnExecuteAsync(CommandLineApplication app) in D:\a\ILSpy\ILSpy\ICSharpCode.ILSpyCmd\IlspyCmdProgram.cs:line 166

ILSpy does work

  • Steps to reproduce

  1. open ILSpy
  2. open the "ModLoaderInstaller-win32.exe_Beware_AutoUpdates.bak" attached file.

Result:

Is able to open and decompile the file. ModLoaderInstaller-win32.exe_Beware_AutoUpdates.bak.zip

Details

  • ILSpyCmd Version:

ilspycmd: 8.2.0.7535 ICSharpCode.Decompiler: 8.2.0.7535

  • ILSpy Vesion: ILSpy version 8.2.0.7535 .NET version 6.0.26-servicing.23605.8+dc45e96840243b203b13e61952230e225d2aac52

NBKRedSpy avatar Jan 15 '24 20:01 NBKRedSpy

The file could be a DLL, not a .NET executable. You can use a tool like PEiD (Windows) or Detect It Easy (Cross-platform) to check.

Sid110307 avatar Jun 04 '24 07:06 Sid110307

Use the latest build from master branch, it is capable of reading this bundle file.

Download can be found here: https://github.com/icsharpcode/ILSpy/actions/runs/9405226877

ElektroKill avatar Jun 07 '24 08:06 ElektroKill