Hey I've switched over to DryIoc from Autofac. My code previously worked but now causes an exception "Recursive dependency is detected when resolving". (Code is simplified)
public class AFactory {
public AFactory(Func<A> getA){ }
}
public class BFactory {
public BFactory(Func<B> getB, AFactory factory){ }
}
public class A {
public A(IrrelevantService service, BFactory factory){ }
}
The actual code is complicated so assume that there is a reason that this code structure is necessary.
It's trying to resolve AFactory --> A --> BFactory --> AFactory and this is causing the issue. But since it's using a Func<> so it should be fine? (or at least it is in Autofac).
Is there a way to register this so that it doesn't throw this exception?