title: ResolutionFailedException with Unity
body: <p>I'm using Patterns and Practices' Unity to inject dependencies into my objects and have hit a weird (to me, anyway) issue.  Here's my class definitions:</p>
  
  <pre><code>public class ImageManager : IImageManager 
  {
      IImageFileManager fileManager;
  
      public ImageManager(IImageFileManager fileMgr)
      {
          this.fileManager = fileMgr;
  
      }
  }
  
  public class ImageFileManager : IImageFileManager
  {
      public ImageFileManager(string folder)
      {
          FileFolder = folder;
      }
   }
  </code></pre>
  
  <p>And here's the code to register my classes</p>
  
  <pre><code>container.RegisterInstance&lt;MainWindowViewModel&gt;(new MainWindowViewModel())
           .RegisterType&lt;IPieceImageManager, PieceImageManager&gt;(
                new InjectionConstructor(typeof(string)))
           .RegisterType&lt;IImageFileManager, ImageFileManager&gt;()
           .RegisterType&lt;IImageManager, ImageManager&gt;(
                new InjectionConstructor(typeof(IImageFileManager)));
  </code></pre>
  
  <p>I originally resolved this in the code behind (I know, it defeats the purpose. Bear with me.) of the XAML file like this</p>
  
  <pre><code>IImageManager imageManager = MvvmViewModelLocator.Container.Resolve&lt;IImageManager&gt;(
      new ParameterOverride("folder", "/images"));
  </code></pre>
  
  <p>And it worked.  But I created a view model for my main view and when I copied the same line into it, I get an exception.  Here are the two most inner exceptions:</p>
  
  <pre><code>InnerException: Microsoft.Practices.Unity.ResolutionFailedException
    HResult=-2146233088
    Message=Resolution of the dependency failed, type = "SwapPuzzleApp.Model.IImageManager", name = "(none)".
  Exception occurred while: while resolving.
  Exception is: InvalidOperationException - The type IImageManager does not have an accessible constructor.
  
  At the time of the exception, the container was:
  
  Resolving SwapPuzzleApp.Model.IImageManager,(none)
  
          Source=Microsoft.Practices.Unity
          TypeRequested=IImageManager
          StackTrace:
               at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
               at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
               at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
               at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)
               at SwapPuzzleApp.ViewModel.MainWindowViewModel..ctor() in c:\Users\Carole\Documents\Visual Studio 2012\Projects\SwapPuzzle\SwapPuzzle\ViewModel\MainWindowViewModel.cs:line 17
               at SwapPuzzleApp.ViewModel.MvvmViewModelLocator..cctor() in c:\Users\Carole\Documents\Visual Studio 2012\Projects\SwapPuzzle\SwapPuzzle\ViewModel\MvvmViewModelLocator.cs:line 51
          InnerException: System.InvalidOperationException
               HResult=-2146233079
               Message=The type IImageManager does not have an accessible constructor.
               Source=Microsoft.Practices.Unity
               StackTrace:
  
               StackTrace:
                    at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForNullExistingObject(IBuilderContext context)
                    at lambda_method(Closure , IBuilderContext )
                    at Microsoft.Practices.ObjectBuilder2.DynamicBuildPlanGenerationContext.&lt;&gt;c__DisplayClass1.&lt;GetBuildMethod&gt;b__0(IBuilderContext context)
                    at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
                    at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
                    at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
                    at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
               InnerException: 
  </code></pre>
  
  <p>I'm not sure what the problem is, as ImageManager clearly has a public constructor.  I thought it might be due to an invalid path, but if I concretely instantiate the object, everything works.</p>
  
  <pre><code>// this line has no problems
  IImageManager imageManager = new ImageManager(new ImageFileManager("/images"));  
  </code></pre>
  
  <p>I also wondered if I needed to pass in new InjectionConstructor(typeof(string)) when I register IImageManager, but it doesn't seem to help and why would it be needed now and not before?  So I'm stumped.  This is my first attempt at using Dependency Injection, so it's probably something basic.  I'm just not seeing what, though.</p>