Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7175969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:24:44+00:00 2026-05-28T16:24:44+00:00

My current understanding of Castle Windsor registration is that one can only validate registration

  • 0

My current understanding of Castle Windsor registration is that one can only validate registration by calling Resolve on a root component. But since windsor’s component model knows each component’s dependencies, it should be possible to test that all dependencies can be satisfied without actually instantiating anything. The main reason for wanting to do this is to have a unit test for registration that doesn’t require me to stub components that call external resources on start-up.

For example. I have a class Root that has a dependency on IChild:

public class Root : IRoot
{
    private IChild child;

    public Root(IChild child)
    {
        this.child = child;
    }
}

If I register Root as IRoot, but don’t register an IChild. When I call resolve like this:

var container = new WindsorContainer().Register(
    Component.For<IRoot>().ImplementedBy<Root>()
    );

container.Resolve<IRoot>();

I get an error:

MyNamespace.Root is waiting for the following dependencies: 

Services: 
- MyNamespace.IChild which was not registered. 

Is there something like:

container.TestResolve<IRoot>();

That would walk the dependency graph and check that all dependencies can be satisfied, but which doesn’t actually instantiate anything?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:24:45+00:00Added an answer on May 28, 2026 at 4:24 pm

    OK, It is possible. Thanks to Krzysztof Koźmic for showing me how. Not immediately obvious, but you can use Windsor’s diagnostic subsystem to raise potential problems with registration. I’ve put together a little static method that throws if there are any misconfigured components:

    private static void CheckForPotentiallyMisconfiguredComponents(IWindsorContainer container)
    {
        var host = (IDiagnosticsHost)container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
        var diagnostics = host.GetDiagnostic<IPotentiallyMisconfiguredComponentsDiagnostic>();
    
        var handlers = diagnostics.Inspect();
    
        if (handlers.Any())
        {
            var message = new StringBuilder();
            var inspector = new DependencyInspector(message);
    
            foreach (IExposeDependencyInfo handler in handlers)
            {
                handler.ObtainDependencyDetails(inspector);
            }
    
            throw new MisconfiguredComponentException(message.ToString());
        }
    }
    

    You can use it like this:

    var container = new WindsorContainer().Register(
        Component.For<IRoot>().ImplementedBy<Root>()
        );
    
    CheckForPotentiallyMisconfiguredComponents(container);
    

    In this case I get a MisconfiguredComponentException with this message:

    'WindsorSpikes.Root' is waiting for the following dependencies:
    - Service 'WindsorSpikes.IChild' which was not registered.
    
    WindsorSpikes.MisconfiguredComponentException:
    'WindsorSpikes.Root' is waiting for the following dependencies:
    - Service 'WindsorSpikes.IChild' which was not registered.
    

    See the castle documentation for more details on the diagnostic subsystem:

    http://stw.castleproject.org/Default.aspx?Page=Debugger-views&NS=Windsor

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, my current understanding of enum is that I can use it to make
So my current understanding of classes are: Singleton for a class that will only
This is admittedly a rather loose question. My current understanding of singletons is that
My current understanding is that superviews have retains each of their subviews. For a
My current understanding is that I have to assign the coordinates in the code
Hi my current understanding of nested transactions in TSQL is that if you have
I have come across a situation that conflicts with my current understanding of methods
Ninject, Sprint.NET, Unity, Autofac, Castle.Windsor are all examples are IoC frameworks that are available.
I have been building a new application using my current understanding of domain driven
I'm meeting some problem understanding how my current Payment Gateway( ProcessPink ) identify duplicate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.