views:

820

answers:

2

Hi all! I'm currently writing server that hosts several modules. Server runs each module in separate AppDomain. What I want to achieve is exception isolation. I mean when one module throws exception I don't want whole process to terminate, just this specific AppDomain. I know that I can tell CLR to fallback to old behaviour (.NET 1.0) when all uncought exception in different threads were swallowed. However, this is not the most 'elegant' solution.

+4  A: 

How about subscribing to this event:

AppDomain.CurrentDomain.UnhandledException

You'll have to cast the ExceptionObject property from type Object to Exception.

Hope that helps.

hmemcpy
A: 

Unfortunately this is not exception handler, instead it only notifies you about unhandled exception. All in all application will still crash :(