Error in one secondary module

Topics: Prism v4 - WPF 4
Jun 17, 2012 at 5:53 PM

The situation where one of the modules of the system generates an exception, this leads to the collapse of the system, though, from this module is independent of the core system.
How to make the system continued to exist even when one of the modules of an exception?

Jun 18, 2012 at 6:36 PM


As mentioned in Chapter 1 - Introduction - Challenges Not Addressed by Prism , Prism does not provide guidance regarding error handling and fault tolerance.

Based on my understanding, a possible approach could be to handle each exception in its corresponding module in order to prevent them from "reaching" the shell application when possible. Like this, each exception would be handled according to the functionality of each module. How to implement this will depend mostly of you personal preferences and the requirements of your scenario.

On the other hand, in WPF, the App class (App.xaml.cs) has a DispatcherUnhandledException event, which is fired when an exception is thrown but it's not handled. By subscribing to this event, you could receive any unhandled exception that is thrown in your application and be able handle it appropriately to prevent the application from crashing. You can find more information about this in the following MSDN article:

Also, I believe you could find the following threads interesting where similar topics were discussed:


Damian Cherubini