When Silverlight initializes, what kind of exception is it throwing?

What's the best exception to throw when a Silverlight application fails on initialization or won't load?

Or should I not throw an exception at all?

+2


source to share


2 answers


In my experience a load / initialization error sometimes results in a managed exception, sometimes not. In some cases, the exclusion or refusal condition may only be available to the client via javascript. In the event of an exception that occurs due to a crash of the entire application, it should be indicated to the user that the application is completely down.



You have to consume and handle exceptions that are thrown from init / load failure. Explicitly throwing exceptions should be reserved for conditions where there is a violation of business logic, communication failure, or other truly exceptional case.

+1


source


I personally don't like the UI that IE shows when a Silverlight application throws an unhandled exception. It has a very small window that displays the exception text, but the options available are of course not user-friendly. I think this is a matter of opinion, but my preference is to catch any exceptions during initialization and try to present the user with a meaningful description of what happened. I usually keep some settings in isolated storage, so one helpful post might describe how to clear the iso store for my app to fix some kind of configuration issue. As long as you can provide the user with some meaningful steps to fix the problem, or at least to get in touch,if they cannot, I would say that it is best not to throw exceptions during initialization that will cause the application to fail to load.



0


source







All Articles