Saturday, September 10, 2011

Creating a crash dump from within the running process

 The idea is that a running application, as part of its error handling could create a dump, preserving interesting information.
Sometimes a stack trace just isn't enough.
I used F# just for funsies.
let something =
    System.Console.WriteLine("Hello")
    let thisProcess = System.Diagnostics.Process.Start("C:\Program Files\SysInternals\procdump.exe", "ConsoleApplication1 dump.dmp")
    thisProcess.WaitForExit()
    System.Console.WriteLine(System.Environment.CurrentDirectory)
    System.Console.ReadLine() 

Procdump is a sysinternals tool, and more suited to this than anything like WinDBG or ADPlus.