title: How to use the same singleton instance from main appdomain in childs appdomain
body: <p>I have a reference to a singleton (CacheLayer ) from a class (InnerModuleInfoLoader) loaded inside a child domain.
  The problem is that this reference is not the same instance as for the rest of the code living in main domain. 
  I wonder if exists any way to circumvent the execution isolation of appDomain to use the instance of the singleton?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>AppDomain subdomain = this.CreatedChildDomain(AppDomain.CurrentDomain);
  </code></pre>
  
  <p>Instantiating class from subdomain</p>
  
  <pre><code>var loader = (InnerModuleInfoLoader) subdomain.
      CreateInstanceFrom(loaderType.Assembly.Location, loaderType.FullName).Unwrap();
  </code></pre>
  
  <p>Inside InnerModuleInfoLoader: Bellow I would like that CacheLayer.Instance will be the same for parent and subdomains.</p>
  
  <pre><code>var server = CacheLayer.Instance.Get&lt;string&gt;("Server");
  </code></pre>
  
  <p>Singleton</p>
  
  <pre><code>public sealed class CacheLayer
  {
      private static readonly CacheLayer instance = new CacheLayer();
      private static readonly ObjectCache cache;
      static CacheLayer()
      {
          cache = MemoryCache.Default;
      }
      private CacheLayer(){}
      //More code omitted
  }
  </code></pre>
  
  <p>Subdomain creation</p>
  
  <pre><code>protected virtual AppDomain CreatedChildDomain(AppDomain parentDomain)
  {
      Evidence evidence = new Evidence(parentDomain.Evidence);
      AppDomainSetup setup = parentDomain.SetupInformation;
      return AppDomain.CreateDomain("ModuleFinder", evidence, setup);
  }   
  </code></pre>