Instantiate Class<T, T> with Windsor, Bug?

0 views
Skip to first unread message

Gian Marco Gherardi

unread,
Oct 12, 2009, 4:56:36 PM10/12/09
to castle-pro...@googlegroups.com
I'm having a problem trying to instantiate a generic class with Windsor, configuring it with xml file.

With this configuration, all works as expected:
		<component id="typewith2generics" type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
<parameters>
<key>${component}</key>
<value>${component}</value>
</parameters>
</component>
Using simple string as parameters, like in the followind configurartion
		<component id="typewith2generics" type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
<parameters>
<key>string value</key>
<value>string value 2</value>
</parameters>
</component>
I get the following exception trying to get an instance of the component:

Key invalid for parameter key. Thus the kernel was unable to override the service dependency

I've created a small project on google code to reproduce the behaviour:

http://code.google.com/p/randomhacking/source/browse/trunk/dotnet/SpikeWindsor/

(the dependencies are located at http://code.google.com/p/randomhacking/source/browse/trunk/dotnet/)

I'm using Windsor 2.0, but the trunk version shows the same behaviour

What do you think?

--
Gian Marco Gherardi

Mauricio Scheffer

unread,
Oct 12, 2009, 6:43:11 PM10/12/09
to Castle Project Development List
You already asked this 3 days ago:
http://groups.google.com/group/castle-project-devel/browse_thread/thread/40f46ced6defe13f
Please use the the users group for further questions:
http://groups.google.com/group/castle-project-users

Cheers,
Mauricio

On Oct 12, 5:56 pm, Gian Marco Gherardi <gianmarco.ghera...@devlab.it>
wrote:
> I'm having a problem trying to instantiate a generic class with Windsor,
> configuring it with xml file.
>
> With this configuration, all works as expected:
>
>                 <component id="typewith2generics"
> type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
>                         <parameters>
>                                 <key>${component}</key>
>                                 <value>${component}</value>
>                         </parameters>
>                 </component>
>
> Using simple string as parameters, like in the followind configurartion
>
>                 <component id="typewith2generics"
> type="SpikeWindsor.TypeWith2Generics`2, SpikeWindsor">
>                         <parameters>
>                                 <key>string value</key>
>                                 <value>string value 2</value>
>                         </parameters>
>                 </component>
>
> I get the following exception trying to get an instance of the component:
>
> Key invalid for parameter key. Thus the kernel was unable to override
> the service dependency
>
> I've created a small project on google code to reproduce the behaviour:
>
> http://code.google.com/p/randomhacking/source/browse/trunk/dotnet/Spi...
>
> (the dependencies are located athttp://code.google.com/p/randomhacking/source/browse/trunk/dotnet/<http://code.google.com/p/randomhacking/source/browse/trunk/dotnet/Spi...>
> )
Reply all
Reply to author
Forward
0 new messages