Allow me to recount my experience with .NET Framework 4.8's AppDomains
. I am presently working on an application that is graphically intensive, requiring approximately 20 seconds to load, with most of the time spent generating the user interface. To mitigate this delay, I resorted to utilizing the MultiDomain
/MultiDomainHost
LoaderOptimization
AppDomainSetup
to create a new AppDomain
and launch the application, allowing it to load within three seconds. This approach proved exceedingly useful for testing purposes, as it allowed me to make substantial modifications to both the frontend and backend, compile the changes, and observe the results in a mere three seconds following the initial 20-second wait period.
Having now migrated my .NET Framework 4.8 project to .NET 7, I have encountered some challenges with AssemblyLoadContext
while attempting to achieve the same functionality as with AppDomain
s. Although I have been able to separate my dynamically loaded DLLs into distinct AssemblyLoadContext
s, I have struggled to achieve proper isolation to conduct successful tests. One of the primary issues I have encountered is that even when I separate the dynamically loaded DLLs, bindings remain shared when using static ViewModels, which has resulted in significant complications. Despite attempting a dozen different approaches to implement isolation, I have been unable to achieve the desired result without commencing a new process, which would undermine the purpose of quick reloads for testing purposes. As a result, I am curious if anyone has any recommendations on how to achieve true isolation.