Generally our handling of .ctors is broken. I started working on fix,
hopefully I'll have some free time after easter to finish it, and
commit the changes.

On Apr 3, 5:55 am, Germán Schuager <[email protected]> wrote:
> Done:http://support.castleproject.org/projects/IOC/issues/view/IOC-ISSUE-198
>
> On Sat, Apr 3, 2010 at 12:37 AM, Mauricio Scheffer <
>
>
>
> [email protected]> wrote:
> > Now that's not so trivial to fix :)
> > Can you create an issue in the bug tracker?
> >http://support.castleproject.org/
> > I created a branch on my fork with the failing test:
>
> >http://github.com/mausch/Castle.InversionOfControl/tree/multiple-cons...
>
> > On Apr 2, 11:56 pm, Germán Schuager <[email protected]> wrote:
> > > Thanks Mauricio.
> > > Now that test pass, but if you register Service before its dependencies
> > it
> > > still fails.
>
> > > On Fri, Apr 2, 2010 at 10:43 PM, Mauricio Scheffer <
>
> > > [email protected]> wrote:
> > > > Fixed in
> > > >http://github.com/castleproject/Castle.InversionOfControl/commit/80bb.
> > ..
>
> > > > Can you give it a try?
>
> > > > Cheers,
> > > > Mauricio
>
> > > > On Apr 2, 9:32 pm, Germán Schuager <[email protected]> wrote:
> > > > > Hi, I have the following class:
>
> > > > >         public class Service
> > > > >         {
> > > > >             public ComponentX X { get; private set; }
> > > > >             public ComponentY Y { get; private set; }
> > > > >             public ComponentA A { get; private set; }
>
> > > > >             public Service(ComponentA a)
> > > > >             {
> > > > >                 A = a;
> > > > >             }
>
> > > > >             public Service(ComponentX x, ComponentY y)
> > > > >             {
> > > > >                 X = x;
> > > > >                 Y = y;
> > > > >             }
> > > > >         }
>
> > > > > and the following test:
>
> > > > >         [Test]
> > > > >         public void
> > > > Kernel_should_select_ctor_with_available_dependencies()
> > > > >         {
> > > > >             var kernel = new DefaultKernel();
> > > > >             kernel.AddComponent<ComponentX>();
> > > > >             kernel.AddComponent<ComponentY>();
> > > > >             kernel.AddComponent<Service>();
>
> > > > >             var service = kernel.Resolve<Service>();
>
> > > > >             Assert.That(service.A, Is.Null);
> > > > >             Assert.That(service.X, Is.Not.Null);
> > > > >             Assert.That(service.Y, Is.Not.Null);
> > > > >         }
>
> > > > > The test fails with this message:
>
> > > > > TestCase
>
> > 'Castle.MicroKernel.Tests.xxx.Kernel_should_select_ctor_with_available_depe
> > > > ndencies'
> > > > > failed: Castle.MicroKernel.Handlers.HandlerException : Can't create
> > > > > component 'Castle.MicroKernel.Tests.xxx+Service' as it has
> > dependencies
> > > > to
> > > > > be satisfied.
> > > > > Castle.MicroKernel.Tests.xxx+Service is waiting for the following
> > > > > dependencies:
>
> > > > > Services:
> > > > > - Castle.MicroKernel.Tests.xxx+ComponentA which was not registered.
> > > > >     Handlers\DefaultHandler.cs(114,0): at
>
> > Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
> > > > >     Handlers\DefaultHandler.cs(53,0): at
>
> > Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext
> > > > > context, Boolean track)
> > > > >     Handlers\AbstractHandler.cs(189,0): at
> > > > > Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext
> > > > context)
> > > > >     DefaultKernel.cs(936,0): at
> > > > > Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler,
> > Type
> > > > > service, IDictionary additionalArguments)
> > > > >     DefaultKernel.cs(918,0): at
> > > > > Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler,
> > Type
> > > > > service)
> > > > >     DefaultKernel_Resolve.cs(68,0): at
> > > > > Castle.MicroKernel.DefaultKernel.get_Item(Type service)
> > > > >     DefaultKernel_Resolve.cs(199,0): at
> > > > > Castle.MicroKernel.DefaultKernel.Resolve(Type service)
> > > > >     DefaultKernel_Resolve.cs(157,0): at
> > > > > Castle.MicroKernel.DefaultKernel.Resolve[T]()
> > > > >     BestConstructorTestCase.cs(213,0): at
>
> > Castle.MicroKernel.Tests.xxx.Kernel_should_select_ctor_with_available_depen
> > > > dencies()
>
> > > > > Is this behavior by design?
> > > > > I don't want to (cannot) register ComponentA in the kernel. How can I
> > > > tell
> > > > > MK to use the second ctor?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Castle Project Users" group.
> > > > To post to this group, send email to
> > [email protected]
> > > > .
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<castle-project-users%2Bun
> > > >  [email protected]><castle-project-users%2Bun
> > [email protected]>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/castle-project-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Castle Project Users" group.
> > To post to this group, send email to [email protected]
> > .
> > To unsubscribe from this group, send email to
> > [email protected]<castle-project-users%2Bun 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/castle-project-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to