[Please download the attached project with full source code available.]
Last week we released a Beta preview of Telerik RadControls for WindowsPhone. You can read more info on the 6 bright new components for Windows Phone here.
RadDiagnostics was one of the released components which received a lot of attention from the Windows Phone developers. This component is sending rich crash reports when an ApplicationUnhandledException has occurred. Read more about RadDiagnostics in this detailed blog post.
One of the features with which RadDiagnostics was created in mind is to allow developers to receive anonymous crash reports without user interaction. By default the control will display a message box notifying the users that an error has occurred and asking them to send the user reports. But sometimes developers do not want to notify users for application exceptions and also users may not be keen to send the data from their email accounts. Using a web service you are sure that all application errors will be reported to you (when users have internet connection).
In this case you can use RadDiagnostics to handle and collect the data on the device and to send this data to your webservice. To do this you need to handle the ExceptionOccured event of RadDiagnostics and to cancel it. Then you can get the data and send it.
In the ExceptionOccured event handler you should cancel the MessageBox, get the already generated data and send it to your web service:
sender, ExceptionOccurredEventArgs e)
// settings Cancel to true will stop the message box from displaying
// add any cusomt code here, like a custom web service
DataCollectorServiceClient serviceClient =
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.
In the attached source I'm showing how to send an email - 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.
I hope this article helps you build more robust applications for Windows Phone 7. If you have any other feedback - please do not hesitate to contact me.
You can also find me on twitter @valiostoychev.
Valentin Stoychev (@ValioStoychev) for long has been part of Telerik and worked on almost every UI suite that came out of Telerik. Valio now works as a Product Manager and strives to make every customer a successful customer.
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.