I want to know if there is a standard way to do some error handling in Windows Phone silverlight application.
What I mean by error handling is something like
- Displaying a dialog windows when data connection lost or any exception in windows phone application.
- Proper way to do logging in run time.
I did some research on this but did not find anything useful, any code example or reference link is welcomed.
Thank you
There seems to be to parts to this question. How to display error messages and how to handle exceptions
Exceptions
A pattern I’ve seen used frequently in many environments and lagugages (not just Silverlight or .NET) is to have a top-level exception handler that handles uncaught exceptions. From here, how you handle the error is up to you. It could be logged to a database, file or discarded.
Handling Errors
In my opinion, the best way is to design the software so that there is a minimum of potential errors and prevent them from occurring in the first place. For instance, if the connection is lost, instead of displaying an error message disable parts of the UI that require a connection and provide some indication to the user is that the app is now in a disconnected.