8

I have some code in C# and C++ ( in one project ). This code have some crash and i trying t find it. but this crash is not reproduce any time - and i can't find it.

I want to configure the code / the windows OS to create dump file on the crash.

the limitation that i have are ... I have limited access to the machine that this crash reproduce on - this is not developing machine .. this is testing Lab machine

So, How to do it ? How can i change the properties in the solution that a new dump file will created on any crash?

(the aim is to be able to analyze the dump in the windbg tool)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Yanshof
  • 9,659
  • 21
  • 95
  • 195

3 Answers3

11

You can register an unhandled exception filter and PInvoke MiniDumpWriteDump. A code sample to do that is located here

John
  • 5,561
  • 1
  • 23
  • 39
4

You can enable saving dumps on vista in the registry:

  1. Open RegEdit
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting
  3. Under Windows Error Reporting, create a new registry key named LocalDumps.
Peter
  • 27,590
  • 8
  • 64
  • 84
4

I find it easier to use ProcDump. Try the -e (create dump on unhandled exceptions), -ma (w/ full process memory), and -t (create dump on app termination) options.

Ilian
  • 5,113
  • 1
  • 32
  • 41
  • 1
    Ah, but when the app crashes it's too late already. No question, I love ProcDump too, but this is not the right situation to use it, methinks. – 0xC0000022L Apr 10 '12 at 11:30
  • 1
    You can use the -e option for unhandled exceptions. It will tell you what caused the crash. – Ilian Apr 10 '12 at 11:32
  • 2
    Fair enough, and a good point +1 then. But this should be part of the answer, in my opinion. – 0xC0000022L Apr 10 '12 at 11:35