2

I am trying to create crash dump for .Net C# application. For this I have written a code which will crash the application for Stack Overflow exception:

namespace Crashme
{
    class Program
    {


        static void Main(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                System.Threading.Thread.Sleep(2000);
            }

            Console.WriteLine("Calling text");

            crash obj = new crash();
            obj.sMyText = "abc";

        }
    }

    class crash
    {
        public string sMyText
        {
            get { return sMyText; }
            set { sMyText = value; }
        } 
    }
}

The procdump command I am using:

.\procdump.exe -ma -e crashme.exe crash_dump1.dmp

The application is crashing as expected and the procdump is catching it too. I can see at the procdump monitoring console prints. But no dump is getting created.

Guess I am not using the correct procdump command. Can someone please help?

Kallol
  • 302
  • 4
  • 16

3 Answers3

10

I recently had a stack overflow bug in production. This blog post has the way to capture it.

https://www.thebestcsharpprogrammerintheworld.com/2017/12/12/capture-a-stackoverflowexception-and-make-a-dump-0xc00000fd/

Essentially you use these options

procdump -accepteula -e 1 -f C00000FD.STACK_OVERFLOW -g -ma <PID> <OUTPUT PATH>
Randy Burden
  • 2,611
  • 1
  • 26
  • 34
ocdi
  • 415
  • 4
  • 9
  • The blog link is dead, but the options did work. Thanks! – Coder14 Jul 15 '21 at 13:25
  • For a .NET Core 3.1 app, this wouldn't work for me even though it was crashing with a stack overflow. So instead I used a more catch-all solution using the following command and this worked: `mkdir C:\MemoryDumps`, `procdump -accepteula -ma -i C:\MemoryDumps`. Once you are finished, run this command to stop capturing memory dumps: `procdump -u`. I also put this info in a Gist: https://gist.github.com/randyburden/a61f9ef867ed867c3e6e270b6b702388 – Randy Burden Nov 03 '21 at 22:07
1

I think you are using the correct command. I duplicated your problem. It just doesn't work. You could try posting on the sysinternals forums.

http://forum.sysinternals.com/

I also have an unresolved question with procdump:

launching procdump from a 64-bit service doesn't work when running as Local Service or Local System

Our company switched to using adplus. We are much happier and it is nice to be able to configure different actions on different types of exceptions.

It looks like it is a bit tricky even with adplus.

Help catching StackOverflowException with WinDbg and ADPlus

Community
  • 1
  • 1
Derek
  • 7,615
  • 5
  • 33
  • 58
  • I figures out that using procdump -ma -e -t crashme.exe crash_dump1.dmp is creating the dump files for me. But when I am trying to debug using Visual Studio 2010 I cannot find any further information since it always returning me the assembly instead of pointing out the line number and module of the error. Can you help me on this? – Kallol Oct 01 '13 at 16:39
  • I'm thinking that using -t might be too late to get a useful dump file. -t Write a dump when the process terminates. You want to get a dump file when the stackoverflow exception occurs. – Derek Oct 01 '13 at 18:27
  • Like I said, you probably need to post on sysinternals forums or start learning adplus (and use the link in my answer for dealing with StackOverflowException ). – Derek Oct 01 '13 at 18:29
-4

You need to install procdump first and specify a dump directory.

procdump.exe -i C:\Path\To\Dumps
Ratul Sharker
  • 7,484
  • 4
  • 35
  • 44