Probably the easiest way is to launch the sysinternals 'ProcDump' tool (see http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx) passing your process id on the command line. You may want to do this from an AppDomain.UnhandledException event, or from an exception filter written in IL/VB. If you write out the dump from a catch block, the original variables will be lost, though you will still have acess to any variables viewable from the catch block.

 

The alternative to creating ProcDump/WinDbg is to P/Invoke to dbghelp!MiniDumpWriteDump. However, its not reliable to write a minidump file of your own process (calling MiniDumpWriteDump with hProcess/ProcessId = GetCurrentProcess()/GetCurrentProcessId()), and you will likely find the P/Invokes harder to get correct then a call to System.Diagnostics.Process.Start.