Hi,
Recently I tried to update to Windsor 3.0 in my project. Everything compiled, but when I started running my AutoMapper mappings that are also registered in the container couldn't be resolved anymore.
When I first tried to isolate the code in a new project, it worked. But then I added the TypedFactoryFacility and bang, exception.
And here is the exception:
Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not instantiate WindsorAutoMapper.DummyMapper
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service System.String was found
at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.
CreateInstanceCore(
ConstructorCandidate constructor,
Object[]
arguments,
Type implType)
at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.
CreateInstance(
CreationContext context,
ConstructorCandidate constructor,
Object[]
arguments)
at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.
InternalCreate(
CreationContext context)
at
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.
Create(
CreationContext context,
Burden burden)
at
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.
CreateInstance(
CreationContext context,
Boolean trackedExternally)
at
Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.
Resolve(
CreationContext context,
IReleasePolicy releasePolicy)
at
Castle.MicroKernel.Handlers.DefaultHandler.
ResolveCore(
CreationContext context,
Boolean requiresDecommission,
Boolean instanceRequired,
ref Burden burden)
at
Castle.MicroKernel.Handlers.DefaultHandler.
Resolve(
CreationContext context,
Boolean instanceRequired)
at
Castle.MicroKernel.DefaultKernel.
ResolveComponent(
IHandler handler,
Type service,
IDictionary additionalArguments,
IReleasePolicy policy)
at
Castle.MicroKernel.DefaultKernel.
Castle.MicroKernel.IKernelInternal.Resolve(
Type service,
IDictionary arguments,
IReleasePolicy policy)
at
Castle.Windsor.WindsorContainer.
Resolve()
at
WindsorAutoMapper.WindsorAutomapperTestFixture.
DummyMapperCanNotBeResolvedIfTheTypedFactoryFacilityIsRegistered()
in
WindsorAutomapperTestFixture.cs: line 64--TargetInvocationException
at
System.RuntimeMethodHandle._InvokeMethodFast(
IRuntimeMethodInfo method,
Object target,
Object[]
arguments,
ref SignatureStruct sig,
MethodAttributes methodAttributes,
RuntimeType typeOwner)
at
System.Reflection.RuntimeConstructorInfo.
Invoke(
Object obj,
BindingFlags invokeAttr,
Binder binder,
Object[]
parameters,
CultureInfo culture)
at
System.Reflection.MethodBase.
Invoke(
Object obj,
Object[]
parameters)
at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.
CreateInstanceCore(
ConstructorCandidate constructor,
Object[]
arguments,
Type implType)
--ComponentNotFoundException
at
Castle.MicroKernel.DefaultKernel.
Castle.MicroKernel.IKernelInternal.Resolve(
Type service,
IDictionary arguments,
IReleasePolicy policy)
at
Castle.Facilities.TypedFactory.TypedFactoryComponentResolver.
Resolve(
IKernelInternal kernel,
IReleasePolicy scope)
at
Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.
Resolve(
IInvocation invocation)
at
Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.
Intercept(
IInvocation invocation)
at
Castle.DynamicProxy.AbstractInvocation.
Proceed()
at
Castle.Proxies.Func`2Proxy.Invoke(
String arg)
at
AutoMapper.TypeMapFactory.<>c__DisplayClass11.<FindTypeMember>b__d(
MemberInfo prop)
at
System.Linq.Enumerable.
FirstOrDefault(
IEnumerable`1 source,
Func`2 predicate)
at
AutoMapper.TypeMapFactory.
FindTypeMember(
IEnumerable`1 modelProperties,
IEnumerable`1 getMethods,
String nameToSearch,
IMappingOptions mappingOptions)
at
AutoMapper.TypeMapFactory.
MapDestinationPropertyToSource(
LinkedList`1 resolvers,
TypeInfo sourceType,
String nameToSearch,
IMappingOptions mappingOptions)
at
AutoMapper.TypeMapFactory.
CreateTypeMap(
Type sourceType,
Type destinationType,
IMappingOptions options)
at
AutoMapper.ConfigurationStore.
CreateTypeMap(
Type source,
Type destination,
String profileName)
at
AutoMapper.ConfigurationStore.
CreateMap(
String profileName)
at
WindsorAutoMapper.Mapper`2.
.ctor(
IConfiguration configuration,
IMappingEngine mappingEngine) in
Mapper.cs: line 23at
WindsorAutoMapper.DummyMapper.
.ctor(
IConfiguration configuration,
IMappingEngine mappingEngine) in
DummyMapper.cs: line 7
Is this a bug in Castle Windsor? Or am I doing something wrong in my AutoMapper registration?
Regards,
Jochen Jonckheere