Windsor and Automatic Properties
When maintaining an old application that uses Windsor as IoC container, a strange NullReferenceException was being thrown when trying to resolve an instance of a specific class. Our project has been recently upgraded to VS 2008 so it was natural to use C# 3.0 specific features. One thing I used in the failing class was Automated Properties. The implementation looked like this:
public class GridRepositoryFactory : IGridRepositoryFactory
{
public GridRepositoryFactory()
{
}
public IDynamicFormDataService Service
{
get;
private set;
}
}
as the stacktrace showed, Castle Windsor version 1.0.3.4333 does not work correctly with inject automated properties. I had to use properties with backing field to solve this, but updating to a more recent version may also get it fixed.