Exception Handling .dependency of modules

Topics: Prism v4 - WPF 4
Nov 19, 2012 at 6:01 AM

I have an application i.e an exe when ran loads 2-3 modules.

For e,g:

When Exe is ran ,

A,B,C,D modules/views get loaded. suppose if an exception occurs in 'A'Module , B,C,D should still work and vice versa. I am using prism to load these modules.

 

How can we make sure other modules are running still even after the other modules are crashed.

 

Thanks for help.

Kind regards

Krishna

 

Developer
Nov 19, 2012 at 8:38 PM

Hi Krishna,

As a starting point, I would like to mentioned that actually, the modules do not "run" in a Prism application. Based on my understanding, after a module is loaded an initialized, the "components" (let's call them like that for now) of that module became components of the rest of your application. For example, its classes will be exported to the application container, the views will be created and injected in other regions, etc. So, the module itself is not "running," what is in an "execution" state are the components provided by the module: for example, a view, view model, shared service, etc. And those "components" are the ones who can throw an exception (and crash).

Taking this into account, you cannot catch the exception of a module, but exceptions of the components separately. How to do this will depend on your personal preferences and the requirements of your scenario.

Also, I believe you could find the following thread interesting were a similar topic was already discussed before:

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini