Questions tagged [circular-dependency]

circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.

1693 questions
13
votes
9 answers

A circular reference has been detected when serializing the object of class "App\Entity\User" (configured limit: 1)

I am faced with a problem that gives me this error: A circular reference has been detected when serializing the object of class "App\Entity\User" (configured limit: 1) I have an Enterprise entity that has mission orders, vehicles, and users. An…
eronn
  • 1,690
  • 3
  • 21
  • 53
13
votes
4 answers

Xcode 10 framework dependency cycle with itself

On Xcode 10 I'm getting this build error with one of my frameworks when I do an incremental build (clean builds work): Showing All Messages :-1: Cycle inside LoggingSharedFramework; building could produce unreliable results. Cycle details: → Target…
Max
  • 21,123
  • 5
  • 49
  • 71
13
votes
3 answers

Angular 4: Cannot instantiate cyclic dependency! InjectionToken_HTTP_INTERCEPTORS

I know, this question may sound duplicate and I have tried everything found on stackover flow unable to resolve this problem, so please bear with me To make you able to reproduce the error I am providing you the whole code thought this Github…
Vikas Bansal
  • 10,662
  • 14
  • 58
  • 100
13
votes
2 answers

Circular dependencies in ES6/7

I was surprised to find that in Babel, I could have two modules import each other without any issues. I have found a few places that refer to this as a known and expected behaviour in Babel. I know that this is widely considered an anti-pattern by a…
Andrew
  • 14,204
  • 15
  • 60
  • 104
13
votes
3 answers

Circular import with structs

I have a project with several modules in Go. I am having problem with circular imports because of the scenario below: Details A module Game contains a struct with the current Game state. Another module (Modifier) is doing some game specific stuff…
rablentain
  • 6,641
  • 13
  • 50
  • 91
13
votes
2 answers

Circular dependency - Injecting objects that are directly depended on each other

I have used Dice PHP DI container for quite a while and it seems the best in terms of simplicity of injecting dependencies. From Dice Documentation: class A { public $b; public function __construct(B $b) { $this->b = $b; …
Ilia Ross
  • 13,086
  • 11
  • 53
  • 88
13
votes
4 answers

Circular Dependency in Two Projects in C#

I have two projects in a solution named ProjectA (ConsoleApplication) and ProjectB (ClassLibrary). ProjectA has a reference to ProjectB. Generally speaking, ProjectA calls a method in ProjectB to do some stuff and return the results to ProjectA.…
Arian Motamedi
  • 7,123
  • 10
  • 42
  • 82
13
votes
2 answers

Lua: How to avoid Circular Requires

Problem How can I avoid the following error from Lua 5.1 when attempting to do a circular require? $ lua main.lua lua: ./bar.lua:1: loop or previous error loading module 'foo' stack traceback: [C]: in function 'require' ./bar.lua:1: in main…
Jess Telford
  • 12,880
  • 8
  • 42
  • 51
12
votes
3 answers

How to solve Circular Dependencies when using classes as Types in Typescript?

How can i use a typing in typescript that does not run into circular dependency errors? It seems that the circular dependency error occurs, even though the imports should be removed when the code compiles to valid JS. Is that a…
12
votes
3 answers

Dealing with a Circular Dependency

I wonder if someone can advise on any good ways to break a circular dependency between 2 classes in Java.FindBugs proposes the use of interfaces so i wonder if someone has any good experience with this type of problem.
tropicana
  • 1,403
  • 2
  • 19
  • 27
12
votes
3 answers

Circular Dependencies in Ruby

Let's say we have two classes, Foo and Foo Sub, each in a different file, foo.rb and foo_sub.rb respectively. foo.rb: require "foo_sub" class Foo def foo FooSub.SOME_CONSTANT end end foo_sub.rb: require "foo" class FooSub < Foo …
Michael Williamson
  • 11,308
  • 4
  • 37
  • 33
12
votes
1 answer

maven cyclic dependency with test scope

We have a ProjectB (only main, not tests) depend on ProjectA. ProjectA's test (not main) depends on ProjectB. We have maven produce two separate artifacts (main and test jars) for each project. So there is really no circular dependency here but…
ppeddi
  • 197
  • 1
  • 12
12
votes
2 answers

Forward declaration & circular dependency

I've got two classes, Entity and Level. Both need to access methods of one another. Therefore, using #include, the issue of circular dependencies arises. Therefore to avoid this, I attempted to forward declare Level in Entity.h: class Level {…
Oracular
  • 367
  • 1
  • 4
  • 13
12
votes
4 answers

Resolving circular dependencies with dependency injection

I've seen several articles on various websites that propose resolving circular dependencies between .NET assemblies by using dependency injection. This may resolve the build errors but it's not really resolving the circular dependency, is it? To…
BostonCoder
12
votes
7 answers

Getting around circular reference in Google Spreadsheet

I have a google docs spreadsheet with two columns: A and B. Values of B are just values from A in a different format, and I have a formula in the B column that does the conversion. Sometimes I do not have the values in A format but I have them in B…
Gian Luca Scoccia
  • 725
  • 1
  • 8
  • 26