Closed DMDTT closed 1 year ago
In fact i noticed that the problem is, that the TryToCreateMissingFamily doesn't have a look into the dependencies of a concrete implementation.
So a type isn't removed of ServiceGraph._byType Hashset. --> @jeremydmiller any suggestions?
Imho --> this would behave like old structuremap configure?
@DMDTT
"In fact i noticed that the problem is, that the TryToCreateMissingFamily doesn't have a look into the dependencies of a concrete implementation." -- I'm not sure I'd say that's true. The concrete type policy absolutely looks into the dependencies of the concrete type.
I'm extremely unenthusiastic about reopening the old StructureMap Container.Configure() can of worms because it's a non-stop source of edge case bugs. Like you just found here:)
Lamar purposely doesn't try to make the container configuration reentrant because it's all kinds of performance killing to do so.
My strong advice is to avoid using Configure()
and instead make alterations at bootstrapping time before you build the container. If this is for testing, Lamar's got this: https://jasperfx.github.io/lamar/guide/ioc/registration/overrides.html
Nothing is going to change here.
Affected version: 8.0.1 | Net6
Afais the lamar container provides an api to replace a service.
I register a specific implementation of IDependency, afterwards I get an Instance of
IImplementation
which holds a dependency ofÌDependency
.In my example the
ToString()
returnsA
as expected throughDependencyA
.Now, as I
m replaceing
DependencyAby
DependencyBI'd expect, that the next
Container.GetInstancecall would return a new Instance of ÌImplenentation
withDependencyB
. In fact this is not a case: I get a new instance ofIImplementation
(verifiable via .GetHashCode()) but still with an instance ofDependencyA
All dependencies are transient
I attach my source here. You can check out also on https://dotnetfiddle.net/uKSwwH