title: C# - Loading assembly at runtime, method called on instance seems to be ineffective
body: <p>I'm trying to load an assembly, instantiate a class from that assembly, and then call Run(), which should set a property inside this instance.</p>
  
  <p>Loading the assembly seems to work fine as I'm able to list the types, but the called method seems to be ineffective: the property located in the new instance remains set to null, depsite the fact that it should be set to something.</p>
  
  <p>I also tried calling the method using a type.InvokeMethod(...) syntax.</p>
  
  <p>Method that loads the assembly, calls the constructor and calls the method:</p>
  
  <pre><code>private IEntryPoint ChargerAppli(AppInfo ai)
  {
          string cheminAssemblies = "D:\\TFS\\OBL Microsoft\\Stages\\2010\\WPF\\Shell\\Shell\\Applications\\";
  
          Assembly a = Assembly.LoadFile(cheminAssemblies + ai.AssemblyName);
          Type type = a.GetType(ai.StartupClass);
  
          IEntryPoint instance = Activator.CreateInstance(type) as IEntryPoint;
          instance.Run();
          return instance;
  }
  </code></pre>
  
  <p>IEntryPoint interface:</p>
  
  <pre><code>public interface IEntryPoint
  {
      FrameworkElement HostVisual { get; set; }
      void Run();
  }
  </code></pre>
  
  <p>IEntryPoint implementation that I'm trying to load, which is located in the new assembly:</p>
  
  <pre><code>class Bootstrap : IEntryPoint
  {
      private FrameworkElement _visuel;
  
      public Bootstrap()
      {
          //do some work;
          this._visuel = new MainVisual();
      }
  
      public System.Windows.FrameworkElement HostVisual { get; set; }
  
      public void Run()
      {
          HostVisual = this._visuel;
      }
  }
  </code></pre>
  
  <p>What may I be missing?</p>