Relying on AppDomain.IsDefaultAppDomain()
- by lysergic-acid
I have a component which should be initialized in a certain way ONLY on the main AppDomain.
On other AppDomains, it is initialized as a proxy to the object that lives in the main appdomain.
The component uses AppDomain.Current.IsDefaultAppDomain() to determine whether it is on the main appdomain or not.
My problem is that when running unit tests (NUnit), this method returns false, as the test runner initializes my test classes in a different app domain, causing the tests to not behave right.
How can this be resolved?