I have a WPF bootstrapper application: it loads my application UI from a separate assembly into another AppDomain then shows the main window. So the application UI runs from this subdomain.
The question: How to handle exceptions in the main domain thrown from the subdomain?
Why? Because my goal is to implement an application updater: when the client realizes that there is a new version is available it would throw some SystemException
with a specific message.
I want the host domain to handle this specific exception: unload the subdomain, download the latest assembly version from the internet and recreate the subdomain by reloading the most up-to-date DLLs.
The problem: It seem to me that an unhandled exception in any AppDomain causes the whole thread to terminate. I found some blog post stating that one should turn on the legacyUnhandledExceptionPolicy
to switch back to the .NET 1.0/1.1 legacy mode exception handling, but I'm not sure that I want to use this legacy stuff in my application.
Is there any other way to properly handle exception in other AppDomains?