Fabrice, This is a known limitation.
I think it may work however, if you register support for lazy explicitly Component.For(typeof(Lazy<>)) .ImplementedBy(typeof(LazyEx<>), LazyServiceStrategy.Instance) .LifeStyle.Transient instead of LazyOfTComponentLoader -- Krzysztof Kozmic On Wednesday, 27 February 2013 at 1:47 AM, Fabrice wrote: > Hi > > I've a CTor like this: > public CompanyComponent(ILogger logger, Lazy<IScheduler[]> schedulers) > > I've configured my container to add Lazy & Collection feature: > > this.container = new DF.ApplicationBlocks.ApplicationContainer.Container(); > // This is my subclass of WindsorContainer > > // Handle collection & array > container.Kernel.Resolver.AddSubResolver(new > CollectionResolver(container.Kernel)); > > // Register lazy loading > container.Register(Component.For<ILazyComponentLoader>().ImplementedBy<LazyOfTComponentLoader>()); > > These lines are set before registering any component. > > Then when I try to resolve the CompanyComponent: > > Castle.MicroKernel.ComponentNotFoundException was unhandled > HelpLink=groups.google.com/group/castle-project-users > (http://groups.google.com/group/castle-project-users) > HResult=-2146233088 > Message=No component for supporting the service > DF.MailFlow.WorkerService.IScheduler[] was found > Source=Castle.Windsor > > If I use DebuggerVisualizer: > Some dependencies of this component could not be statically resolved. > 'DF.MailFlow.WorkerService.CompanyComponent' is waiting for the following > dependencies: > - Service 'System.Lazy`1[[DF.MailFlow.WorkerService.IScheduler[], > DF.MailFlow.WorkerService, Version=2.0.0.0, Culture=neutral, > PublicKeyToken=1eb1c673988515c1]]' which was not registered. > > To know if the problem was coming from Lazy or from Array, using immediate > window I've tried to resolve: > - IScheduler : succeeded > - IScheduler[]: failed > - List<IScheduler>: failed > - IList<IScheduler>: failed- Lazy<IScheduler>: succeeded > > So it's seems it comes from the array. I've also tried using the "old" > ArrayResolver, but same problem. I've added 2 screenshot with more details on > the container content and on the exception. > > I've 6 IScheduler component registered, so does someone have an idea on why > it throw this exception ? > > Thank you > Fabrice > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > (mailto:[email protected]). > To post to this group, send email to [email protected] > (mailto:[email protected]). > Visit this group at http://groups.google.com/group/castle-project-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > Attachments: > - 2013-02-26_16h29_41.png > > - 2013-02-26_16h27_01.png > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/castle-project-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
