This article describes how RadDiagnostics can be used to collect diagnostic data anonymously.
The RadDiagnostics allows developers to receive anonymous crash reports without user
The default behavior of the control is to display a message box notifying the users that an error
has occurred and asking them to send the report. But sometimes the developers don't want to notify
the users about the exception. Users also might not be keen on sending the data from their email
accounts. The solution here is to use a web service.
When a web service is used, the RadDiagnostics will serve to handle and collect the data and to send
this data to this web service. To stop the MessageBox from showing, the ExceptionOccurred event has
to be handled and canceled. Then the data can be sent.
radDiagnostics = new RadDiagnostics();
radDiagnostics.EmailTo = "Me@MyCompany.com";
radDiagnostics.ExceptionOccurred += new EventHandler<ExceptionOccurredEventArgs>(radDiagnostics_ExceptionOccurred);
In the ExceptionOccurred event handler you should cancel the MessageBox, get the already generated
data and send it to your web service:
void radDiagnostics_ExceptionOccurred(object sender, ExceptionOccurredEventArgs e)
e.Cancel = true;
SendDiagnosticsToWebService((sender as RadDiagnostics).DiagnosticInfo);
private void SendDiagnosticsToWebService(string diagnosticInfo)
DataCollectorServiceClient serviceClient = new DataCollectorService.DataCollectorServiceClient();
serviceClient.CollectDataAsync(radDiagnostics.ApplicationName, radDiagnostics.ApplicationVersion, diagnosticInfo);
In the web service implementation you are free to do anything with the received data. You can simply
send yourself an email or you can store it in database and build some sort of reports based on the data.
Note that you must have the email functionality configured on the server where you are hosting
the web service in order to be able to send emails.