The most common scenario I've seen is the ability to provide extensibility with a different security model than the main program.
Loading a plugin into a separate AppDomain allows two things:
- You can implement a more limited security model.
- You can prevent the plugin from dropping the application if it does not work
Another nice use of AppDomains is to download and verify the build. Running this in a separate AppDomain allows you to collect information (or run code) from a separate assembly, and then unload the entire assembly from your process space. If you download an assembly directly, it cannot be unloaded. This is also useful if you want to "upgrade" the type to a new version at run time (that is, load the remote assembly and reload it later).
Reed copsey
source share