title: Problems with AssemblyResolve event on created AppDomain
body: <p>I am trying to customize the assembly resolution process by wrapping the <code>AppDomain</code> and its <code>AssemblyResolve</code> event inside a class. The simplified version of my <code>ClassLoader</code> is below. The problem I am having is that when the event <code>AssemblyResolve</code> is fired, it seems that I get a new instance of <code>ClassLoader</code>, not the one I previously created.</p>
  
  <pre><code>[Serializable]
  public class ClassLoader // : IDisposable
  {
      public AppDomain Domain { get; private set; }
      public string FooProperty { get; set; }
  
      public ClassLoader(string domain) {
          Domain = AppDomain.CreateDomain(domain);
          Domain.AssemblyResolve += Domain_AssemblyResolve;
      }
  
      private Assembly Domain_AssemblyResolve(object sender, ResolveEventArgs args)
      {
          Console.WriteLine(
              "ClassLoader HashCode: {0} FooProperty: {1}\n\n", 
              GetHashCode(), 
              FooProperty);
          // ...
          return null;
      }
      // ...
  }
  </code></pre>
  
  <p>When executing this code, FooProperty is not initialized in the Domain_AssemblyResolve event handler and the ClassLoader instance has a different hash code from "c".</p>
  
  <pre><code> var c = new ClassLoader("demo");
   c.FooProperty = "Foo";
   Console.WriteLine(
       "c Hash Code: {0} FooProperty: {1}", 
       c.GetHashCode(), 
       c.FooProperty);
   c.Domain.CreateInstanceAndUnwrap("Not important", "Not important");
  </code></pre>
  
  <p>Do you what is happening? or some workaround?</p>
  
  <p>Thanks!</p>