title: Unity fails to resolve basic dependency chain
body: <p>I'm implementing dynamic loading and registration of my assemblies in Unity IoC.</p>
  
  <p>Given these classes:</p>
  
  <pre><code>public interface IA { }
  public interface IB { }
  public interface IC { }
  
  public class A : IA { }
  public class B : IB
  {
      public B(IA a) { }
  }
  
  public class C : IC
  {
      public C(IB b) { }
  }
  </code></pre>
  
  <p>And this configuration:</p>
  
  <pre><code>var assembly = Assembly.LoadFile(@"path\MyAsm.dll");
  container.RegisterTypes(
      AllClasses.FromAssemblies(assembly),
      WithMappings.FromAllInterfacesInSameAssembly,
      WithName.Default,
      WithLifetime.Transient);
  </code></pre>
  
  <p>The code: </p>
  
  <pre><code>var c = container.Resolve(typeof(IC));
  </code></pre>
  
  <p>Throws:</p>
  
  <blockquote>
    <p>A first chance exception of type
    'Microsoft.Practices.Unity.ResolutionFailedException' occurred in
    Microsoft.Practices.Unity.dll</p>
    
    <p>Additional information: Resolution of the dependency failed, type =
    "MyAsm.IC", name = "(none)".</p>
    
    <p>Exception occurred while: while resolving.</p>
    
    <p>Exception is: InvalidOperationException - The type IC does not have an
    accessible constructor.</p>
    
    <hr>
    
    <p>At the time of the exception, the container was:</p>
    
    <p>MyAsm.IC,(none)</p>
  </blockquote>
  
  <p>All of the above code is performed in the same assembly MyAsm. Analyzing the container in debug, the <code>Registrations</code> property lists what seems to be proper collection of mappings of <code>A</code>, <code>B</code> and <code>C</code> to their respective interfaces as well as themselves.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>After Tyler's response I changed:</p>
  
  <pre><code>var assembly = Assembly.LoadFile(@"path\MyAsm.dll");
  </code></pre>
  
  <p>to </p>
  
  <pre><code>var assembly = Assembly.LoadFrom(@"path\MyAsm.dll");
  </code></pre>
  
  <p>which solved the issue. These two methods on <code>Assembly</code> have same argument and same return type and <a href="https://stackoverflow.com/questions/1477843/difference-between-loadfile-and-loadfrom-with-net-assemblies">vary just slightly in behavior</a>. <strong>Pure evil</strong>.</p>