title: Castle Windsor: Exception thrown when resolving Component with LifeStyleScoped
body: <p>I have a three components: A, B and C.</p>
  
  <p>They are registrered in the following manners:</p>
  
  <pre><code>public class Installer : IWindsorInstaller
  {
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
      container.Register(Component.For&lt;IA&gt;().ImplementedBy&lt;A&gt;());
      container.Register(Component.For&lt;IB&gt;().UsingFactoryMethod(Resolve).LifestyleScoped());
      container.Register(Component.For&lt;IC&gt;().ImplementedBy&lt;C&gt;().LifestyleScoped());
    }
  
    private static IUnitOfWork Resolve(IKernel kernel)
    {
      IA a = kernel.Resolve&lt;IA&gt;();
      B b = new B(a);
      kernel.ReleaseComponent(a);
      return b;
    }
  }
  </code></pre>
  
  <p>When I Resolve C I do it in the following manner:</p>
  
  <pre><code>public void Test()
  {
    using (ContainerAccessor.Instance.IocContainer.BeginScope())
    {
      using (IB b = containerAccessor.Instance.IocContainer.Resolve&lt;IB&gt;())
      {
        IC c = ContainerAccessor.Instance.IocContainer.Resolve&lt;IC&gt;();
        ...
        b.Commit();
  
        return result;
      }
  }
  </code></pre>
  
  <p>The <strong>first time</strong> I access it, an exception is thrown : "InvalidOperationException: Scope was not available. Did you forget to call container.BeginScope()?".</p>
  
  <p>I partly solve it by wrapping the content of the Resolve method with a <code>using (kernel.BeginScope) { ... }</code>.
  I said it was partly solved because when I put a breakpoint in the resolve method, it still throws the exception the first time I access it.
  Does someone have an idea of what is happening here?</p>
  
  <p>Thanks a lot.</p>