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
Using unregister on keyed registrations result in NRE across all Resolve methods:
Version: all versions (tested on 2.* and 4.7.*) Actual:
[TestMethod]
public void Repro()
{
var implementationType1 = typeof(A);
var implementationType2 = typeof(B);
var interfaceType = typeof(ITargetInterface);
var container = new Container();
container.Register(interfaceType, implementationType1, serviceKey: "foo");
container.Register(interfaceType, implementationType2, serviceKey: "bar");
container.Unregister(interfaceType, serviceKey:"foo");
Assert.ThrowsException<ContainerException>(()=> container.Resolve(interfaceType, "foo")); //<---throws NRE
container.Resolve(interfaceType, "foo", IfUnresolved.ReturnDefault); //<---throws NRE
container.ResolveMany(interfaceType, ResolveManyBehavior.AsFixedArray);//<---throws NRE
}
Expected:
Resolve with key with optional -> return default
Resolve with key - > throws ContainerException
ResolveMany for interface -> returns single registered service
PS:
Also throws on container.ClearCache(interfaceType);
The text was updated successfully, but these errors were encountered:
Using unregister on keyed registrations result in NRE across all Resolve methods:
Version: all versions (tested on 2.* and 4.7.*)
Actual:
Expected:
Resolve with key with optional -> return default
Resolve with key - > throws ContainerException
ResolveMany for interface -> returns single registered service
PS:
Also throws on
container.ClearCache(interfaceType);
The text was updated successfully, but these errors were encountered: