oz.
oz.

Reputation: 11

How can I take a dump file for Winforms application

I have a C# application which is crashing for unknown reason.

For understanding the issue, i want to take a dump file for it.

How can i do it?

many thanks,

Oz.

Upvotes: 1

Views: 1670

Answers (3)

Jason Evans
Jason Evans

Reputation: 29186

If you're using Windows Vista/7 or Server 2008, then you can open Task Manager and manually create a dump file, as explained here. I would recommend using Windbg for catching the crash, as Mez suggested, since then you can perform immediate crash dump analysis on the process.

Upvotes: 1

Mez
Mez

Reputation: 2857

Are you talking about taking a minidump when your application crashes so you can debug it with windbg or cdb ?

If yes, there are different approaches:

DrWatson
-Run drwtsn32 -i at the commandprompt, this will activate dr watson and let it listen in the background for all crashes.

Windbg
-Run windbg -I from the commandpromt starting from the installation folder of Windbg.
-When a crash occurs, windbg will immediately load the crash dump.

Make sure you download and install the Debugging tools for Windows first.

Upvotes: 1

Graviton
Graviton

Reputation: 83244

You must catch the exception and output it to a log file in your main.

i.e.,

static int main()
{
  try
  {
  }
  catch (Exception ex)
  {
    WriteToLogFile(ex);
  }
}

Upvotes: -1

Related Questions