Capturing memory dumps is a common troubleshooting methodology. DebugDiag is usually an ideal choice for collecting memory dumps. I will be discussing on how we can gather memory dumps using DebugDiag when an application hosted on IIS encounters a First-chance exception.
Before we proceed, lets understand what a First-chance exception is. From here:
What is a First-Chance Exception?
When an exception is first thrown, whether from the application itself or from dependent or platform code, it is known a “first chance” exception – the debugger is given the first chance of inspecting the exception prior to the application handling it (or not). All exceptions start as first chance exceptions, and the debugger gets notified each time an exception is thrown.
Pre-requisites:
NOTE: Please ensure you have sufficient disk space when using DebugDiag to capture memory dump. The dump files are as big as the process. So if you have a process consuming 600 MB, the dump file would around ~600 MB. If there are many files created then you are running at the risk of crashing the server due to insufficient disk space.
There are 2 ways to capture FIRST CHANCE EXCEPTION memory dumps of a process.
Method 1: Generate a dump for all First Chance Exception
This is the easiest way to capture a dump for any exception that is raised within the process. However, this is not the recommended way to gather data as this captures any exception and in some scenarios where there are too many exceptions can lead to generation of too many memory dumps which can have negative impact on the machine and the disk space. Below are the steps to configure the same:
Note: If the target is a web application hosted on IIS then, choose either “All IIS/COM+ related processes” or “A specific IIS web application pool”.
This will generate a dump for any unconfigured exception that may occur inside the target process. The file name will be in the following format:
<ProcessName>__<ApplicationPool>__PID__<PIDValue>__Date__<DateValue>__Time_<TimeValue>__First chance exception<Exception_Code>.dmp
Example: w3wp__DefaultAppPool__PID__10032__Date__05_09_2012__Time_12_52_51PM__406__First chance exception 0XE0434352.dmp
Method 2: Target a specific First Chance Exception (Recommended)
Refer the instructions in Method 1 until step 5. After that refer the below instructions. For the purpose of this post, we are targeting OutOfMemoryException.
The dumps created by this rule will be in the following format:
<ProcessName>__PID__<PID>__Date__<DateValue>__Time_<TimeValue>__First Chance <ExceptionName>.dmp
Example: w3wp__PID__2364__Date__05_09_2012__Time_12_59_51PM__406__First Chance System.OutOfMemoryException.dmp
NOTE: DebugDiag help menu already has documented steps on how to gather data in most of the scenarios.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.