Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lazy cyclic dependencies are no longer possible in v2.0

See original GitHub issue


Since v2.0, it is no longer possible to have a cyclic dependency where one of the dependencies is lazy resolved. this results in the following error:

error DIE001: A cyclic dependency has been found Pure.DI.Example.Dependency <-- System.Lazy<Pure.DI.Example.IDependency2> <-- System.Func<Pure.DI.Example.IDependency2> <-- Pure.DI.Example.Dependency2 <-- Pure.DI.Example.Dependency.

In v1, code was generated to resolve the lazy dependency lazily.


public class Dependency : IDependency
    public Dependency(Lazy<IDependency2> dependency2) { }

public class Dependency2 : IDependency2
    public Dependency2(IDependency dependency) { }

public partial class Composition
    public static void Setup() =>


Issue Analytics

  • State:closed
  • Created a month ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

Yves-Becommented, Aug 10, 2023

That seems to work, up until you inject IDependency in the Service. I believe it is good enough for my case though.

NikolayPianikovcommented, Aug 11, 2023

Fixed in 2.0.13

Read more comments on GitHub >

github_iconTop Results From Across the Web

Circular dependencies solutions? - java
I'm trying to work out the uses of lazy initialization, allowing circular dependencies to be true and whether or not I call a...
Read more >
Lazy circular dependencies no longer work · Issue #105
Lazy circular dependencies work with Node.js and other CommonJS module loaders/bundlers. I think it is important to maintain parity with the ...
Read more >
Circular Dependencies in Spring
When we have a circular dependency, it's likely we have a design problem and that the responsibilities are not well separated.
Read more >
Circular Dependencies in Spring
Here as you can see, there is a circular dependency and Spring won't be able to decide which of the beans should be...
Read more >
code quality - What's wrong with circular references?
Circular object references can crash naïve recursive algorithms (such as serializers, visitors and pretty-printers) with stack overflows. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found