icsharpcode / ILSpy

.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
21.33k stars 3.34k forks source link

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

Open NBKRedSpy opened 8 months ago

NBKRedSpy commented 8 months ago

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

Result:

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

Details

ilspycmd: 8.2.0.7535 ICSharpCode.Decompiler: 8.2.0.7535

Sid110307 commented 3 months ago

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.

ElektroKill commented 3 months ago

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