icsharpcode / ILSpy

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

Does not work with .net core assemblies #789

Closed matafonoff closed 7 years ago

matafonoff commented 7 years ago

There's an exception if I'm trying to decompile asp.net core assembly

System.OutOfMemoryException: Array dimensions exceeded supported range. at Microsoft.Cci.Pdb.MsfDirectory..ctor(PdbReader reader, PdbFileHeader head, BitAccess bits) at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Dictionary2& tokenToSourceMapping, String& sourceServerData, Int32& age, Guid& guid) at Mono.Cecil.Pdb.PdbReader.PopulateFunctions() at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader(ImageDebugDirectory directory, Byte[] header) at Mono.Cecil.ModuleDefinition.ProcessDebugHeader() at ICSharpCode.ILSpy.LoadedAssembly.LoadSymbols(ModuleDefinition module) at ICSharpCode.ILSpy.LoadedAssembly.LoadAssembly(Object state) at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute()

VahidN commented 7 years ago

It's duplicate of https://github.com/icsharpcode/ILSpy/issues/779

AArnott commented 7 years ago

I agree it's a dupe, but the dupe has been closed with an unrelated fix.

memark commented 7 years ago

The fix (deleting the .PDB) works for me for any .NET Core assembly.

Did you try it @AArnott?

AArnott commented 7 years ago

Yes. It works for me too. I mentioned that here: https://github.com/icsharpcode/ILSpy/issues/779#issuecomment-285719981

airbreather commented 7 years ago

https://github.com/airbreather/ILSpy/tree/github-789

I have no idea what I'm doing (thus no pull request just yet), but running it in VS2017 makes it feel like the problem is fixed. 26 tests fail, but debugging through them it's always just at the File.Delete calls because apparently something's keeping the files open (so I'm going to ignore those).

I saw the newdecompiler branch but that's a lot bigger of a fix than this, so I thought it might be worth putting this out there.

Semi-unrelated changes are from a VS2017 "one-way-upgrade" on ILSpy.AddIn.

dungtm007 commented 7 years ago

Thanks @memark It works for me ;)

dgrunwald commented 7 years ago

This was likely fixed in the new decompiler engine (which just landed on the master branch).