Let’s say your application throws exceptions with custom error messages when a specific condition occurs. This exception will show up in Event Viewer. However, the information in the event log may not be sufficient to troubleshoot the issue. You may need a full userdump to find out what’s going on in the background.
If you want to collect a dump file automatically for the custom exceptions, follow the steps below.
For the simple test application I created, I used the following lines to throw an exception. This Visual Basic application simply threw “Cannot determine the proforma” error when the user clicked Button1.
Public Class _Default Inherits Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load End Sub Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Throw New Exception("Cannot determine the proforma") End Sub End Class
When I clicked the button, the event log below showed up in Event Viewer.
Log Name: Application Source: ASP.NET 4.0.30319.0 Event ID: 1309 Task Category: Web Event Level: Warning Keywords: Classic Description: Event code: 3005 Event message: An unhandled exception has occurred. Process information: Process ID: 6476 Process name: w3wp.exe Exception information: Exception type: Exception Exception message: Cannot determine the proforma at Test.Default.Button1_Click() at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain
Set up DebugDiag to create dumps for custom exceptions
Follow the steps below to create a DebugDiag rule to capture a dump file automatically when the exception occurs again next time:
- Open DebugDiag Collection
- Click “Add Rule”
- Select “Crash”. Click “Next”
- Select “All IIS/COM+ related processes” and click “Next”
- Click “Exceptions”
- Click “Add Exception”. In this window:
- Select “CLR Exception” on the left side
- On the right side, add a part of your exception message into “Exception Message Includes” field. Do not use quotation marks (Screenshot for a sample rule is below)
- Select “Full Userdump” from the “Action Type” list
- Click OK
- Click “Save & Close”
- Click “Next” and follow the rest of the instructions to complete the rule creation
If the DebugDiag throws the error “System.Exception: AutoUpdate failed”, check out the solution in this post: DebugDiag error “System.Exception: AutoUpdate failed”