I am developing a large application which consists of many smaller plugins/applications.
They are not big enough to be a full process, but are too small to be run in
Just adding some extra info on the subject for anybody that considers (been there myself) using application domains mainly to guarantee the stability of an application:
A few years ago, the System.AddIn
team published a very interesting blog entry. Using AppDomain Isolation to Detect Add-In Failures.
It explains that only out-of-process add-ins can guarantee the stability of the host. More specifically:
Starting with the CLR v2.0 unhandled exceptions on child threads will now cause the entire process to be torn down and thus it is impossible for a host to completely recover from this.
So what they suggest is to subscribe to the AppDomain.UnhandledException and before your application crashes, store somewhere (a log, a database etc.) information about who caused this exception. Then the next time your application starts use this information to protect your application. Perhaps you don't load the add-in or you inform the user and let her/him decide. (Microsoft Office applications followed this approach and disabled the plugins that crashed the host. You then had to re-enable them yourself.)
They also published another blog entry that shows how to do this even in scenarios where the host is running in another host (IIS, WAS etc.). More on Logging UnhandledExeptions from Managed Add-Ins.
Although both these articles are centered around System.AddIn
, they contain useful information for anyone trying to increase the stability of their plugin-aware application.