[MOVED] Castle Project Documentation - Discussion

2012/11/14 23:57 by Adil Baig
transient object and .NEt 4.0's parellel.For
Hi guys, I have a complex Abstract syntax tree parser / generator implemented using ANTLR and I have maintained each node's state as transient windsor objects. So before parser starts, i do container.Install(FromXml) where its a big XML of each state which is going to be used in a tree parser.

problem is i am sequentially going down the tree atleast 30 levels with very heavy housekeeping state objects for a tabular data for 2000 rows for 200 fields each row so as an attemp to reduce time, i am trying to leverage .NET's parellel for loops as:

// for each row Parellel.For(0, N (i) => { // for each column Parellel.For(0, N, (i) => { // use (i) in constructing a XML node tree using windsor container invoked states for each node. } });

but the point i switched to Parellel.For versus traditional for loop i started getting errors in state, my tracking counters, backtracking dictionaries are clashing saying already invoked states and what not.

my container itself is wrapped in a singleton, does it matter? the objects are created on the fly in transient so wouldnt every call to container.resolve() create new objects to me. would two thread working between a resolve() and release() call matter as each should be with its own state object??
2012/11/15 00:02 by Krzysztof Koźmic
Re: transient object and .NEt 4.0's parellel.For
Hey there,

this is a documentation wiki. Please ask questions like that on StackOverflow or the users gorup.

2013/04/25 10:57 by Bosy
Order of creating component interceptors and dependencies in DefaultComponentActivator

Can anyone explain what is wrong in this scenario?

Imagine you have component with dependency which has lifestyle scoped. In interceptor of component I want to open scope for dependency. Unfortunately dependencies are created before interceptor of component is created and that is why scope for dependencies is not available.

Following is a part of code of DefaultComponentActivator.cs from Castle.MicroKernel sources. I added some comments.

protected virtual object Instantiate(CreationContext context)
var candidate = SelectEligibleConstructor(context);

// here dependencies are created
var arguments = CreateConstructorArguments(candidate, context);

// here proxy object (with interception) for component is created
return CreateInstance(context, candidate, arguments);
Shouldn't component interceptor be at least created before creating dependencies? Is there any other way to open scope before creating dependencies?


I posted it in the wrong place but I can't remove it
2013/04/25 11:03 by Krzysztof Koźmic
Re: Order of creating component interceptors and dependencies in DefaultComponentActivator

it's best to ask questions like that on StackOveflow.com

if you want, I can remove it from here
2013/06/21 11:17 by borntorun
Improve documentation

I don't know if this is the right place to say it.... hope so.

Are there any plans to improve the wiki/documentation? (i'm talking about the Windsor container area)

I found it very dificult for someone new trying to adopt or beginning using the various features of the famework.

I think it lacks most complete examples (step-by-step) with more realistic situations; its very hard to see the whole picture;

In the web there are some examples and blog posts and tutorials (like http://dotnetslackers.com/articles/designpatterns/InversionOfControlAndDependencyInjectionWithCastleWindsorContainerPart1.aspxthis one) but they all are, I think, in some parts, old and obsolete in relation with the last version.

I understand this is an open project and maybe time is not much but in my opinion a good documentation is crucial for adopting it.

2013/06/21 11:19 by Krzysztof Koźmic
Re: Improve documentation
Hi there,

Actually I think this discussion may be better suited for the users discussion group https://groups.google.com/forum/#!forum/castle-project-users
2014/06/20 09:01 by abramo
Castle Windsor can't Proxy/Intercept a WinForm with AllowDrop = true
I'm using VS2013, castle windsor v 3.3, winform project in C#,.NET Framework 4.0.

If i mark the class of a form with the attribute

Castle.Core.Interceptor(typeof(MyInterceptor)) and the form have the property AllowDrop = true

at runtime will raise a ComponentActivatorException

{"ComponentActivator: could not proxy FormTest"}

inner exception:

Can not create proxy for type System.Windows.Forms.ISupportOleDropSource because it is not accessible. Make it public, or internal and mark your assembly with [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] attribute, because assembly System.Windows.Forms is strong-named."

if I set AllowDrop = false all work fine.

There is some workaround?