
Adding a customized Automated Error Reporting dialog box to your application
Please note that this walkthrough uses the SmartAssembly SDK, which is available only in SmartAssembly Pro and Developer editions.
Step 1: Locate the SDK sample code
The SDK samples are installed with SmartAssembly in Program Files\Red Gate\SmartAssembly 6\SDK\Exception Reporting\
Figure 1. Locating the SDK Samples.
In this example, Sample 3 – Template with Custom UI is used.
Sample 3:
- Is designed for easy customization.
- Targets standard Windows desktop applications (not Silverlight).
- Collects email addresses from users who submit error reports, but also allows them to submit error reports anonymously.
If you have different requirements, use the most appropriate sample instead.
Step 2: Open the SDK sample code in Visual Studio
The SDK sample code C# project file Sample 03 - Template with Custom UI.csproj is opened in Visual Studio.
Figure 2. Opening an SDK sample in Visual Studio.
Step 3: Design your exception reporting dialog box
Using the Visual Studio designer, edit the sample code to suit your requirements.
Figure 3. Editing the sample SDK code to meet your needs.
Step 4: Add extra information to the error report
If required, you can add extra parameters to error reports as custom properties. Call e.AddCustomProperty() inside the OnReportException() method.
You can also attach one or more files to the error reports. Call e.AttachFile() inside the OnReportException() method.
Figure 4. Intrumenting your code to attach additional information / files to your error reports.
Step 5: Add error reporting to your SmartAssembly project
Then you need to build the customized template as a DLL. Use SmartAssembly to enable Automated Error Reporting in your application, and select the DLL you built as the Custom Template.
For more information, see Setting up error reporting.
Figure 5. Activating Automated Error Reporting in your SmartAssembly project.
Step 6: Set an email template to respond to your customers
If required, you can set an email template. The template opens in your email program, ready to send to your customer, when you receive their error report. This helps to reassure your customers that you take their feedback seriously. To set up a template email, see Collecting your customers' email addresses in a custom template on Error reporting with the SDK.
Figure 6. Creating an email template to automatically send back to users who have reported an error.
Step 7: Use SmartAssembly to build your application.
When your application encounters an unhandled exception, the rebranded dialog box is displayed:
Figure 7. The customized dialog box your users see when an error occurs.
When you view the error report in SmartAssembly, the custom property, attached file, and the submitted email address are included with the stack trace:
Figure 8. An error report received by the developer, as viewed from within SmartAssembly.
Double-click on the Customer e-mail address to open the template email in your email client:
Figure 9. Opening up the pre-defined template for responding to your users.
Try SmartAssembly for yourself: download your 14-day free trial.
SmartAssembly can protect your Winforms, Silverlight, Windows Phone 7, ASP.NET applications and more. It can also be integrated into build processes using MS Build or the command-line.

