# Capture memory dumps on First Chance Exception using DebugDiag

**URL:** <https://community.dynatrace.com/t/capture-memory-dumps-on-first-chance-exception-using-debugdiag/46560>\
**Category:** Troubleshooting\
**Tags:** memory-dump\
**Created:** [July 12, 2024, 6:16am UTC](https://community.dynatrace.com/t/capture-memory-dumps-on-first-chance-exception-using-debugdiag/46560 "2024-07-12T06:16:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhushangholap](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bhushangholap](https://community.dynatrace.com/u/bhushangholap)\
**Post date:** [July 12, 2024, 6:16am UTC](https://community.dynatrace.com/t/capture-memory-dumps-on-first-chance-exception-using-debugdiag/46560/1 "2024-07-12T06:16:30Z")

</div>

We often need to capture memory dumps to investigate issues. I am sharing below guide to collect memory dumps using DebugDiag :

**Pre-requisites :**

- Download&nbsp;DebugDiag ([download](https://www.microsoft.com/en-us/download/details.aspx?id=103453))
- Windows 2008 and higher

There are 2 ways to capture&nbsp; **FIRST CHANCE EXCEPTION** &nbsp;memory&nbsp;dumps of a process.

- **Method 1** : Generate a dump for all First Chance Exception  
Or
- **Method 2** : Target a specific First chance exception (Recommended)

**Method 1: Generate a dump for all First Chance Exception**

1. Launch DebugDiag

2. In the&nbsp; **Rules** &nbsp;tab select&nbsp; **Crash** &nbsp;and click on&nbsp;Next.  
&nbsp;  

3. In “ **Select Target Type** ”&nbsp;select “ **A specific process** ” and click on&nbsp;Next.

4. In “ **Select Target** ” select the target process and click on&nbsp;Next.

5. In “**Advanced Configuration (Optional)**” under “ **Unconfigured First Chance Exceptions** ” set the following:&nbsp;  
**Action type for unconfigured first chance exceptions** :&nbsp; **Full Userdump**  
**Action Limit for unconfigured first chance exceptions** :&nbsp; **10**

6. Click on&nbsp; **Next** &nbsp; **twice** and then click on&nbsp; **Finish** &nbsp;to activate the rule.

**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 will use&nbsp; **StackOverflowException**.

1. In “**Advanced Configuration (Optional)**” click on the&nbsp; **Exceptions…** &nbsp;button :

2. In “ **First chance Exception Configuration** ” click on “ **Add Exception…** ”

3. In “ **Configure Exception** ” select the **CLR Exception** &nbsp;from the LHS and since we are targeting **StackOverflowException** , specify the details as shown below:&nbsp;  
**.NET Exception Type** :&nbsp; **System.StackOverflowException**  
**Action Type** :&nbsp; **Full Userdump**  
**Action Limit** :&nbsp;5

4. **NOTE** : The Exception type is case sensitive. Ensure it is entered correctly.

5. Click on&nbsp;Ok&nbsp;and then click on “ **Save & Close** ”.

6. Click on&nbsp; **Next** &nbsp;twice and then click on&nbsp; **Finish** &nbsp;to activate the rule.
