0

I am using the ILDASM utility to disassembly assemblies (our own).

(We use this to compare different build outputs against each other by stripping the unique content out of the disassenmbled files before running a hash calculation to compare the content).

Some of the assemblies are up to 5,900KB in size and this results in a System out of memory exception - this while the ILDASM tool is processing the assembly.

Is there a limit to the assembly size you can disassemble?

Update: I don't use the tool as is, I start it as a process in code (as part of a custom tool):

Where assemblyFilePath is the path to the >5MB assembly:

var startInfo = new ProcessStartInfo(ILDasmFileLocation, string.Format("/all /text \"{0}\"", assemblyFilePath))
{
    WindowStyle = ProcessWindowStyle.Hidden,
    CreateNoWindow = true,
    UseShellExecute = false,
    RedirectStandardOutput = true
};

using (var process = Process.Start(startInfo))
{
    string output = process.StandardOutput.ReadToEnd();

    // Use the disassembled output
}
NubieJ
  • 575
  • 2
  • 9
  • 21
  • I have disassembled assemblies up to 20MB, most of the size is taken up by embeded image resourses. So 5900KB is not the limit. – kennyzx Aug 29 '14 at 06:57
  • Updated my question with an example of how I use it – NubieJ Aug 29 '14 at 13:51
  • first test _you_ need to make is, for the erroring assemblies, does running the _identical_ ILDASM command from the command line work? if so pipe its output to a file, how big is that? – tolanj Aug 29 '14 at 14:03
  • 1
    the thrust of my comment above is that this is almost certainly a 'ReadToEnd' issue not an ILDASM one. The question above is intended to confirm that – tolanj Aug 29 '14 at 14:08
  • Thanks tolanj, looks like you are right. I did a similar exercise using command prompt as folllows: ildasm "c:\AssemblyX.dll" /out="C:\temp\out.txt" and this worked fine, so it does look like this is not related to ILDASM at all... – NubieJ Sep 01 '14 at 07:03
  • and how big was the out.txt file? – tolanj Sep 01 '14 at 09:29
  • Approximately a 100MB, does that sound right though? 5MB disassemled to a 100MB sized file? – NubieJ Sep 01 '14 at 14:12
  • Yes sounds possible, your underlying issue us therefore trying to do a ReadToEnd on an 100MB stream. Could you do parts of your logic ON a stream, ie can you run you hash without global access to the string? A second approach is look at the IL and see _why_ its so big. – tolanj Sep 03 '14 at 16:02

0 Answers0