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

  • Home
  • SEARCH
  • 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 9203441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:28:28+00:00 2026-06-17T23:28:28+00:00

There seems to be an issue with passing generic arguments when attempting to create

  • 0

There seems to be an issue with passing generic arguments when attempting to create a parametrized instance with Castle Windsor

Demo of Failure to Pass Generic Arguments

    private static void Main(string[] args)
    {
        PassGenericParamAtResolutionTime();
        Console.ReadLine();
    }

    private static void PassGenericParamAtResolutionTime()
    {
        Console.WriteLine("Passing generic argument fails");
        var container = new WindsorContainer();
        container.Register(Component.For<ISandCoordinator<Simpleton>>()
                           .ImplementedBy<SandCoordinator<Simpleton>>());
        var runtimeConstructorParam = new GenericManager<Simpleton>(
                                          "This Id Does Not Get Through");
        var runtimeArguments = new Arguments(
                                   new object[] {runtimeConstructorParam});
        var shouldBeParameterizedCoordinator = container
                   .Resolve<ISandCoordinator<Simpleton>>(runtimeArguments);
        Console.WriteLine(shouldBeParameterizedCoordinator.Log);
    }

Console Output

Passing generic argument fails
Birth from parameterless constructor, which should not happen

And if I comment out the parameterless constructor below, I get the following exception:

Castle.MicroKernel.Resolvers.DependencyResolverException was unhandled
Missing dependency.
Component Sand.SandCoordinator`1[[Sand.Simpleton, WindsorSand, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] has a dependency on Sand.IGenericManager`1[Sand.Simpleton], which could not be resolved.
Make sure the dependency is correctly registered in the container as a service, or provided as inline argument.

Demo Class with Two Constructors

class SandCoordinator<TSimpleton> : ISandCoordinator<TSimpleton>
                                    where TSimpleton : ISimpleton
{
    public SandCoordinator()
    {
        Log = "Birth from parameterless constructor, which should not happen";
    }

    public SandCoordinator(IGenericManager<TSimpleton> manager)
    {
        Log = "Birth from parameterized constructor";
        Log += Environment.NewLine + "Born With Manager: " + manager.Id;
    }        

    public string Log { get; private set; }
}

Solutions / Workarounds?

  • I know that if I create a non-generic type interface ISimpleSandCoordinator : ISandCoordinator<Simpleton> and register the non-generic interface then parametrized resolution works, but I don’t want to stop using generic types
  • Should this be filed as a bug in Castle Windsor?

[ Using Castle.Core.dll and Castle.Windsor.dll 3.1.0 (2012-08-05) ]

  • 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-06-17T23:28:29+00:00Added an answer on June 17, 2026 at 11:28 pm

    Your SandCoordinator<T> depends on IGenericManager<T>, not GenericManager<T>.

    When you’re putting a value in Arguments that you want Windsor to use as something else than its concrete type you have to be explicit about it.

    new Arguments { { typeof(IGenericManager<Simpleton>), runtimeConstructorParam } };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There seems to be an issue simulating the backspace key with java.awt.Robot . This
In my app after a while, there seems to be a huge issue. There
I have a survey on a website, and there seems to be some issues
My app has a registered shutdown function and it seems there's some issues with
There seems to be a breaking (i.e. backwards-incompatible) change in the CSS Syntax Module
There seems to be a lot of questions asking for regex to detect a
There seems to be a distinct lack of documentation of the GObjects module for
There seems to be a similar question to this on here but with the
There seems to be too many attributes/parameters in CSS... I want to know all
There seems to be a bug in a Wordpress PHP function that leaves whitespace

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.