This repository has been archived by the owner on Dec 14, 2017. It is now read-only.
/
IOC-115.xml
113 lines (101 loc) · 3.68 KB
/
IOC-115.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0" encoding="utf-8"?>
<issues>
<issue>
<field name="Priority">
<value>Major</value>
</field>
<field name="Type">
<value>Bug</value>
</field>
<field name="State">
<value>Fixed</value>
</field>
<field name="Assignee" />
<field name="Subsystem">
<value>No subsystem</value>
</field>
<field name="Fix versions" />
<field name="Affected versions">
<value>RC 3</value>
</field>
<field name="Fixed in build" />
<field name="numberInProject">
<value>115</value>
</field>
<field name="summary">
<value>Cannot resolve a dependency from a parent container under certain circumstances.</value>
</field>
<field name="description">
<value>When resolving a component from a child container that has a dependency on another component in the child container, which in turn has a dependency on a component in the parent container, the operation fails.
The following code reproduces the issue:
using System;
using System.Collections.Generic;
using System.Text;
using Castle.Windsor;
namespace TestCastle
{
class Program
{
static void Main( string[] args )
{
WindsorContainer parent = new WindsorContainer();
WindsorContainer child = new WindsorContainer();
parent.AddComponent( "service", typeof( IParentService ), typeof( ParentService ) );
child.AddComponent( "service1", typeof( IChildService1 ), typeof( ChildService1 ) );
child.AddComponent( "service2", typeof( IChildService2 ), typeof( ChildService2 ) );
parent.AddChildContainer( child );
IChildService1 service = child.Resolve<IChildService1>();
}
}
public interface IParentService
{
}
public class ParentService : IParentService
{
}
public interface IChildService1
{
}
public class ChildService1 : IChildService1
{
public ChildService1( IChildService2 xxx )
{
}
}
public interface IChildService2
{
}
public class ChildService2 : IChildService2
{
public ChildService2( IParentService xxx )
{
}
}
}</value>
</field>
<field name="created">
<value>1199680531000</value>
</field>
<field name="updated">
<value>1341105310781</value>
</field>
<field name="reporterName">
<value>baggins</value>
</field>
<field name="updaterName">
<value>xtoff</value>
</field>
<field name="resolved">
<value>1228860540000</value>
</field>
<field name="watcherName">
<value>User: id = 20-18[up-to-date]</value>
</field>
<field name="permittedGroup">
<value>All Users</value>
</field>
<comment author="ayenderahien" text="This works:

 [Test]
 public void Cannot_resolve_a_dependency_from_a_parent_container_under_certain_circumstances()
 {
 WindsorContainer parent = new WindsorContainer();
 WindsorContainer child = new WindsorContainer();

 parent.AddChildContainer(child);

 parent.AddComponent("service", typeof(IParentService), typeof(ParentService));
 child.AddComponent("service1", typeof(IChildService1), typeof(ChildService1));
 child.AddComponent("service2", typeof(IChildService2), typeof(ChildService2));


 child.Resolve<IChildService1>();
 }" created="1228860574000" />
<comment author="ayenderahien" text="* '''Resolution''' set to ''Fixed''.
* '''Status''' changed from ''Open'' to ''Resolved''.
" created="1228860540000" />
<comment author="xtoff" text="Part of this behaviour is being reverted in v3.1 to fix #IOC-345" created="1341105310781" />
</issue>
</issues>