We're using Castle.Windsor in our projects as dependency injection library and it is great. The main drawback in using any IoC is that it brings some obscurity and if project is big, IoC configuration is complex - finding IoC configuration bugs may be a real headache, because they will tend to hide themselves under various exceptions, hard to understand situations.
Yesterday I was fighting a bug that was causing Object Disposed exception and it was driving me mad. I was able to find it only after I've stuffed dependent services with Logging and Guid's of object instances only to find out, that one service was configured as Singleton on IoC configuration. As long, as Singleton lifestyle is default in Castle.Windsor, it's an easy mistake to make - just forget to set custom lifestyle for component and you have a potential problem.

Now, there are couple solutions to this problem:

1) You can override default lifestyle in Castle.Windsor:

container.Kernel.ComponentModelCreated += new ComponentModelDelegate(ComponentModelCreated);

void ComponentModelCreated(ComponentModel componentModel)
    if (componentModel.LifestyleType == LifestyleType.Undefined)
        componentModel.LifestyleType = LifestyleType.Transient;

2) You can have a test, that allows only components from white list to be with Singleton lifestyle:

public void GivenIocRegistration_Container_ShouldNotHaveComponentsWithSingletonLifestyle()
   var allowedSingletonHandlers = new[]

   var handlers = container.Kernel.GetAssignableHandlers(typeof(object));
   var singletonHandlers = handlers
       .Where(x =>
              x.ComponentModel.LifestyleType == LifestyleType.Singleton &&

   Assert.AreEqual(0, singletonHandlers.Count);
Comments c#  Ioc  Castle.Windsor