Application Crashes
What is an Exception
In the .NET Framework, an exception is an object that inherits from the System. Exception class. An exception is thrown from an area of code where a problem has occurred.
Simple words: An exception occurs when the application is trying to do something,but it couldn’t.
The exception is passed up the call stack to a place where the application provides code to handle the exception. If the application does not handle the exception, the browser is forced to display the error details.
Most exception objects are instances of some derived class of the Exception class, such as the SystemException class, the IndexOutOfRangeException class, or the ArgumentNullException class. The Exception class has properties, such as the StackTrace property, the InnerException property, and the Message property, that provide specific information about the error that has occurred.
How to troublesoot crashes on applications
We need to understand
- Who throws the exception? Exceptions can be generated by the common language runtime (CLR), by .NET or third-party libraries, or by application code.
- What is the stack?
- If its 1st chance exception or 2nd chance exception?
The exact name of the exception
- Out of memory exception
- StackoverflowException
- Error code
First and Second exceptions
On the following chart you will be able to find more details on how the first and second exceptions works.
What is a Crash Dump?
Crash dump is a snapshot of your application as it was crashing, and immediately before all resources are unloaded and the process is terminated. Depending on the type of crash dump collected, that can contain different data. At the lowest level, you can get the call stack of the thread which had the exception.
Data collection
If the application is crashing due to exit code or fatal exception at native later, the option is to collect a crash dump.
We can generate dump on first chance exception using Procdump:
procdump.exe -accepteula -ma -e 1 -f <Exception Name>
<Process ID>
We can use crash diagnose to capture stack overflow exeption:
If you saw StackOverflowException exception code was recorded in d:\home\logfiles\eventlog.xml, it means the exception is managed exception. Then you should set exception code as “overflow” or “StackOverflowException”, Managed Exception as “Yes”
Crash Monitoring: