I know there are huge hurdles to overcome if you want to do something like loading PRISM modules in separate app domains so they can be loaded and unloaded. I'm trying to load everything in a new app domain. This includes the shell window (that holds the view region), the bootstrapper, and the modules.
I built a sample solution that mimics the way I need to implement this per the current software we are trying to transition. For now, this includes the EXE that basically loads some settings, a Core class and Wrapper class which handle loading the app domain, loading the shell window and module discovery (The Core creates the new app domain and loads an instance of the Wrapper into it while the Wrapper discovers the modules and instantiates the shell), and finally the shell itself which is responsible for showing the shell and loading modules on demand.
The problem I have run into is, when the Wrapper class is loaded into a new App Domain, everything runs without an exception but the module is never displayed (digging further shows that the view is never added to the viewregion, apparently because the viewregion is never added to the Regions in the RegionManager). Everything works just fine if I instantiate the Wrapper in the original App Domain.
I am trying to figure out why this is happening and if there is a work-around. I know the process seems complex but it's the method we are shooting for, for various different reasons. Any help on why I am having problems with the ViewRegion and App Domain would be greatly appreciate. Here is a link to the solution: https://gist.github.com/fb8f989f42ceb3f4ee56.git
First, it looks like my code for this question no longer exists on Git. I do have an example solution I could share if anyone needs it.
The problem stems from the fact that the DependencyObject designated to be the ViewRegion is never created. Inside of the RegionManager, the DependecyObject is checked to see if it is in DesignMode which causes CreateRegion not to be called if it returns true. Here is another question who's answer helps explain the problem and the fix for it.
How to use Prisim within an ElementHost