-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Using the WithConcreteTypeDynamicRegistrations(), when injecting a range of class, where no registrations has been added, results in instantation of an item.
Other scenarios:
- When using
WithAutoConcreteTypeResolutionthe issue does not occur. - If item has been registered, then issue does not occur.
- Other range interfaces (
IList,ICollectionetc.) results in same issue. - Injecting a range of interfaces (eg.
IThing), the issue does not occur.
Setup:
class Program
{
void Main()
{
var rules = Rules
.Default
//.WithAutoConcreteTypeResolution()
.WithConcreteTypeDynamicRegistrations();
var container = new Container(rules);
container.Register<MyRegistry>();
var registry = container.Resolve<MyRegistry>();
}
}
class MyRegistry
{
public MyRegistry(IEnumerable<Thing> things)
{
/* 'things' contains a single thing */
Debugger.Break();
}
}
class Thing
{
Guid Id { get; set; }
}
Expected Behavior:
'things' should be empty.
Current behavior:
'things' contain a single item.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working