Adding a customized Automated Error Reporting dialog box to your application

Download the article Download this article

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\

Locating the SDK sample code

Figure 1. Locating the SDK Samples.

In this example, Sample 3 – Template with Custom UI is used.

Sample 3:

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.

Opening the SDK sample code 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.

Designing an exception reporting dialog box

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.

Calling e.AttachFile()

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.

Adding Automated Error Reporting in SmartAssembly

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.

Setting up an email template

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:

An exception occurs in QueryBee

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:

Viewing an error report in SmartAssembly

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:

Emailing a custoemr using the template email

Figure 9. Opening up the pre-defined template for responding to your users.

Try SmartAssembly for yourself: download your 14-day free trial.

from $993
SmartAssembly is licensed per production build machine (any machine you use to produce release builds).

Got a question?
0800 169 7433
Technologies supported

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.

See PDF for full details