I'm trying to create a dump using DebugDiag that will contain information for non-handled .NET exceptions.
The creation of the dump file seem to be dependant on the running code, which I don't understand why.
These are the steps I've taken:
Prepare a simple console application named
DebugDiagTest
with the following code, which throws anInvalidOperationException
exception:using System; namespace DebugDiagTest { class Program { static void Main(string[] args) { if (ShouldAwaitKeyPress(args)) Console.ReadLine(); Throw(); } static void Throw() { throw new InvalidOperationException(); } static bool ShouldAwaitKeyPress(string[] args) { var shouldAwaitKeyPress = false; if (args.Length > 0) { bool.TryParse(args[0], out shouldAwaitKeyPress); } return shouldAwaitKeyPress; } } }
Compile and run with
DebugDiagTest.exe true
, and DO NOT press any key yet; let it wait for a key press (step 4).Prepare a DebugDiag exception rule (you can follow this article).
Go back to the running
DebugDiagTest.exe
, then press some key to make it crash.Go to
C:\Program Files\DebugDiag\Logs\Crash rule for all instances of DebugDiagTest.exe
, and you'll see a.dmp
file.Now run with
DebugDiagTest.exe false
, go again toC:\Program Files\DebugDiag\Logs\Crash rule for all instances of DebugDiagTest.exe
, and you'll see that no.dmp
file was created.
You can now re-run DebugDiagTest.exe true
whatever times you'd like, and see that a dump file is created each time. However, re-running DebugDiagTest.exe false
never creates a dump file.
My question:
Why running DebugDiagTest.exe true
creates a dump, while DebugDiagTest.exe false
doesn't?
DebugDiagTest.exe true
, while runningDebugDiagTest.exe false
never creates a dump file. – OfirD