Closed cguedel closed 4 years ago
I think that's cause the current release is not using the Abstractions from Unity, please try this PR instead, https://github.com/unitycontainer/microsoft-dependency-injection/pull/58 that's been updated to 5.11.1.
Not sure what is the problem here. Could you please provide more info?
The problem is that the code is littered with casts that assume that a IUnityContainer
instance is always of type UnityContainer
.
E.g. https://github.com/unitycontainer/microsoft-dependency-injection/blob/master/src/ServiceProviderExtensions.cs#L48 or https://github.com/unitycontainer/microsoft-dependency-injection/blob/master/src/ServiceProviderFactory.cs#L67
If the methods signature suggests to accept an IUnityContainer
instance, I don't see the need to cast it to UnityContainer
. If that's needed, I suggest to change the signature to accept only the concrete type.
UnityContainer
type is required to register extensions.
We're having an extended version of
IUnityContainer
for testing purposes in place. We cannot use that container instance with these extensions, as they (for some unknown reason) cast the instance passed asIUnityContainer
(in the method signature) toUnityContainer
causing a casting exception.