An old thread, but it was linked to by an issue with recent activity on 
GitHub...

@Xavier - see issue #100 for how Windsor infers the dependency between 
component A and the sub-component.  
https://github.com/castleproject/Windsor/issues/100

On Saturday, August 30, 2014 at 1:38:37 AM UTC+10, Xavier wrote:

> Hi,
> Back after a while. I have tried to understand what happens in our 
> application and finally, I have a sample application to provide, which I 
> think reproduces the problem:
> - a component A has a dependency on a TypedFactory.
> - because it creates a transient sub-component using this typed factory, 
> it also releases this component using the typed factory (best practice)
>  => The sub-component is disposed twice
> 1) first from the intercepted Release method of the factory (expected), 
> 2) second because Windsor believes there is dependency between component A 
> and its sub-component? 
>
> The last point is really surprising because, if it's the reality, Windsor 
> is not supposed to know it. At least, there is a dependency with the typed 
> factory but nothing else. Otherwise, I don't understand the best practice 
> <http://docs.castleproject.org/Windsor.Typed-Factory-Facility-interface-based-factories.ashx>
>  
> regarding release methods.
>
> Thank you for your answer
> Xavier
>
> Le lundi 30 juin 2014 15:49:26 UTC+2, Xavier a écrit :
>>
>> Hi,
>> I have an strange problem with an application and it's really annoying 
>> because I'm not able to reproduce it with a simple sample. I hope my 
>> explanation will be clear enough.
>>
>> To summarize:
>> - we have a transient UI component created by a typed factory A
>> - this component itself has a dependency with another typed factory B: in 
>> the constructor, it uses it directly to create a transient view model.
>> - when disposed (through its typed factory A), this UI component uses its 
>> dependent typed factory B to release the VM.
>> - the problem is that the VM is disposed twice?
>>
>> When I look at the call stack:
>> 1) the first Dispose is called after the release interception from the 
>> typed factory B. This is expected.
>> 2) the second one is called because the VM is listed as a dependency of 
>> the UI component?
>>
>> This last point is really surprising and wrong: if I look at the 
>> container during the application startup, this dependency is not listed in 
>> the component's model.
>> So I tried to understand how Windsor could add this dependency and found 
>> it in the CreationContext.ExitResolutionContext() method: when the UI is 
>> created, the typed factory B is called for the VM resolution, and in the 
>> ExitResolutionContext() method Windsor adds a dependency with the VM into 
>> the UI.
>>
>> We use Windsor 3.2.1.
>>
>> Thank you for your help.
>> Xavier
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to