Wednesday, 31 December 2008


This has caught me out a couple of times now. I was getting this exception: Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate MyNameSpace.ClassName ---> System.ArgumentNullException: Value cannot be null.
Parameter name: types
at System.Type.GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, Type[] s
The exception could be a bit more informative - it turns out this is caused by not providing a public constructor on the class (it was accidentally set to 'protected').


Anonymous said...

Thank you!!!

Anonymous said...

Thanks that solved my issue too - my constructor was protected instead it should have been public.