4

In my past life as a COBOL mainframe developer I made extensive use of a tool called Abendaid which, in the event of an exception, would give me a complete memory dump including a formatted list of every variable in memory as well as a complete stack trace of the program with the offending statement highlighted. This made pinpointing the cause of an error much simpler and saved a lot of step-through debugging and/or trace statements.

Now I've made the transition to C# and .NET web development I find that the information provided by ASP.NET only tells half the story, giving me a stack trace, but not any of the variable or class information. This makes debugging more difficult as you then have to run the process again with the debugger to try and reproduce the error, not easy with intermittent errors or with assemblies that run under the likes of SQL Server or CRM.

I've looked around quite a lot for something that does this but I can't find anything obvious. Does anyone have any idea if there is one, or if not, what I'd need to start with in order to write one?

James Webster
  • 4,046
  • 29
  • 41
Dave
  • 131
  • 2
  • 9

3 Answers3

1

Take a look at DebugDiag.exe - it includes utilities to get a memory dump that can be analyzed with windbg.

The Debugger Host: The Debugger Host (DbgHost.exe) hosts the Windows Symbolic Debugger Engine (dbgeng.dll) to attach to processes and generate memory dumps.

(emphasys mine)

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Is there anything that would allow me to dump just what was used by my assembly/assemblies? I wouldn't want everything from the IIS worker process or worse SQL Server just to find out why just my assembly was failing. – Dave Mar 28 '12 at 15:05
  • @Dave - I don't think you can be that specific, though you can use the [user mode dumper](http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4060) to dump specific processes. – Oded Mar 28 '12 at 15:41
  • Would it be possible to write my own using something like reflection? Dumping a 20GB SQL Server process to disk and then trying to trawl through it to find out what caused an exception in my code isn't really an option. – Dave Mar 29 '12 at 13:57
  • @Dave - windbg and the sos extensions should help with that even on a 20GB SQL Server process. I don't know if reflection can help. – Oded Mar 29 '12 at 14:04
1

After extensive googling for ".NET memory dump" I found this as a first non-commercial link. There's also similar thread on SO: Tool for analyzing .Net app memory dumps.

Community
  • 1
  • 1
Karel Frajták
  • 4,389
  • 1
  • 23
  • 34
  • From that SO thread: > Opening big dump (> 1 GB) can take a few hours though, but for us > it's worth the wait. I don't know if they have trial version, but if > they do you should definitely give them a shot. The SQL Server process that runs the assembly I'm interested in is currently at 20GB so that's not really an option. I was hoping for something that would allow me to target a specific assembly's memory. I should have been a bit clearer sorry. – Dave Mar 28 '12 at 15:59
1

To automate the generation of process dumps you can:

  • Use AdPlus from the Debugging Tools for Windows (it can be xcopy deployed from an installation of the tools to the target machine: no need to add an install in production).
  • Use ProcDump from SysInternals.

Once you have the dump, you'll need the SoS ("Son of Shrike") extensions in WinDBG to get .NET level information.

Richard
  • 106,783
  • 21
  • 203
  • 265