You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Foo : IFoo
{
public Foo(string view) {}
}
[Test]
public void ParameterOverridesWithOnType()
{
var ioc = new UnityContainer();
ioc.RegisterType<IFoo, Foo>(new HierarchicalLifetimeManager());
ioc.CreateChildContainer().Resolve<IFoo>(new ParameterOverride("view", "qq").OnType<Foo>());
ioc.CreateChildContainer().Resolve<IFoo>(new ParameterOverride("view", "qq").OnType<Foo>());
}
The test above fails at the second call to Resolve with exception:
"Unity.Exceptions.ResolutionFailedException : Resolution of the dependency failed, type = 'Tests.UnityTests+IFoo', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value."
Single call to Resolve works as expected. HierarchicalLifetimeManager and CreateChildContainer are necessary preconditions for the error. The test worked allright with the older Microsoft.Practices v2.1 unity container.
The text was updated successfully, but these errors were encountered:
Unity.Container 5.8.6
.Net Framewrok 4
The test above fails at the second call to Resolve with exception:
"Unity.Exceptions.ResolutionFailedException : Resolution of the dependency failed, type = 'Tests.UnityTests+IFoo', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value."
Single call to Resolve works as expected. HierarchicalLifetimeManager and CreateChildContainer are necessary preconditions for the error. The test worked allright with the older Microsoft.Practices v2.1 unity container.
The text was updated successfully, but these errors were encountered: