New Psscor2 commands – DumpAllExceptions

There have been a few places where you can see this command run, but I wanted to talk about it here officially.  This command is used to display all of the exceptions that are currently in the managed heap.  One interesting thing is that this function actually looks at what class the object derives from and if it derives from System.Exception, then it will show up in the list.  So you can have your own custom exceptions shown here regardless of what naming mechanism you use for your class.

There is some helpful information about the output from this command here: ASP.NET Debugging - ASP.NET Tips- DumpAllExceptions, namely that if you run it twice, you may see different callstacks from the various exceptions.

Here is the documentation straight from !help:

 0:017> !help dumpallexceptions
-------------------------------------------------------------------------------
!DumpAllExceptions [-v]

!DumpAllExceptions will go through the entire managed heap and find any objects that are derived 
from System.Exception.  It will print out the inner exceptions and other common items of an 
exception.  This will only print out one exception of each type and give you the count of those 
type of exceptions.

The -v parameter will print out each exception individually. 

As you can see, one key aspect to note is that this command will group exceptions together, as seen here:

 0:017> !dae
Going to dump the .NET Exceptions found in the heap.
Loading the heap objects into our cache.
Number of exceptions of this type:        1
Exception MethodTable: 60828c04
Exception object: 03d510b4
Exception type: System.ExecutionEngineException
Message: <none>
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80131506
The current thread is unmanaged
-----------------

Number of exceptions of this type:        1
Exception MethodTable: 60828b74
Exception object: 03d5106c
Exception type: System.StackOverflowException
Message: <none>
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 800703e9
The current thread is unmanaged
-----------------

Number of exceptions of this type:        1
Exception MethodTable: 60828ae4
Exception object: 03d51024
Exception type: System.OutOfMemoryException
Message: <none>
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 8007000e
The current thread is unmanaged
-----------------

Number of exceptions of this type:        2
Exception MethodTable: 60828c94
Exception object: 03d510fc
Exception type: System.Threading.ThreadAbortException
Message: <none>
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80131530
The current thread is unmanaged
-----------------

Total 5 exceptions

So if you want to see all the exceptions of a particular type, use the -v switch.  One more important thing to keep in mind, this will only print out these sections of an exception (the ones you see above). So if you want to see something particular to an exception, you need to dump it out using !dumpobj.