7

I'm currently writing a server that hosts several modules. The server runs each module in a separate AppDomain. What I want to achieve is exception isolation, i.e. when one module throws an 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 uncaught exceptions in different threads were swallowed. However, this is not the most 'elegant' solution.

4

1 回答 1

8

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.

于 2008-10-23T07:41:11.323 回答