Questions tagged [circular-reference]

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

Circular references can appear in computer programming when one piece of code requires the result from another, but that code needs the result from the first.

Information is taken from Wikipedia, more information available there.

758 questions
8
votes
4 answers

Circular reference issue in 3-tier architecture C#

I want to build a web application with 3-tier architecture in ASP.NET. But I am getting a problem of circular referencing. I have 3 layer: Application layer containing UI. Business layer containing all the logic and domain classes. Data layer…
atul
  • 561
  • 4
  • 12
7
votes
2 answers

How to save an object with circular references?

I want to save locally an object which has circular references. What are my options? My first thought was using HTML5 local storage but I can't stringify this object due to the circular references. Specifically I'm trying to save the DOMSelection…
nebs
  • 4,939
  • 9
  • 41
  • 70
7
votes
1 answer

Visual Studio for Mac: Logs work on a Project and are shown on Azure, but fail on another Project of same Solution

On the main Project of the Solution I have: public static void Main(string[] args) { // Testing Logs on Azure Application Insights: var telemetry = new Microsoft.ApplicationInsights.TelemetryClient(); telemetry.TrackTrace("Test of…
chelder
  • 3,819
  • 6
  • 56
  • 90
7
votes
4 answers

Circular reference — architecture question

This is probably a very beginner question but I have searched a lot of topics and couldn't really find the same situation, although I'm sure this kind of situation happens all the time. My project/program is going to track changes to drawings on…
moiv
  • 73
  • 4
7
votes
5 answers

Difference between adding a unit to the interface or the implementation section

If I have a unit that is filled with constants like... unit AConsts; interface const Const1 : WideString = 'Const1'; Const2 : WideString = 'Const2'; Const3 : WideString = 'Const3'; Const4 = 100; Const5 = 100; implementation end. and…
Aikislave
  • 646
  • 5
  • 10
7
votes
2 answers

AutoMapper: What is the difference between PreserveReferences and MaxDepth?

I'm a little bit confused. I can't find out the difference between PreserveReferences and MaxDepth. Let's suppose we have the following DTOs and models. public class PersonEntity { public PersonEntity InnerPerson { get; set; } } public class…
Joseph Katzman
  • 1,959
  • 6
  • 21
  • 47
7
votes
1 answer

How to detect circular references in JavaScript

For example: $ node > var x = {} undefined > x.x = x { x: [Circular] } Wondering the sort of structures are they using to accomplish this, because it's not encoded directly into what I just did. It seems like they would do something like: var graph…
Lance
  • 75,200
  • 93
  • 289
  • 503
7
votes
1 answer

Xamarin garbage collector and circular references

While reading Xamarin docs under section "Performance", I've noticed the following chapter: The following diagram illustrates a problem that can occur with strong references: Object A has a strong reference to object B, and object B has a strong…
Lou
  • 4,244
  • 3
  • 33
  • 72
7
votes
3 answers

Circular Dependency among two Projects of Different Solution

Suppose there are two .net projects not under same solution. ProjectA is under solution1 and ProjectB is under solution2. ProjectA has a reference of ProjectB and ProjectB has reference of ProjectA. There are two classes ProjectA_Class and…
7
votes
1 answer

How to find the circular structure in JSON.stringify: Uncaught TypeError: Converting circular structure to JSON?

When I get Uncaught TypeError: Converting circular structure to JSON on a large structure it can be very difficult to find out where exactly the circular reference is. Is there a simple way to find/debug the circular element in the data structure?
Michael_Scharf
  • 33,154
  • 22
  • 74
  • 95
7
votes
2 answers

Circular Reference error when serializing objects in ASP.NET Web API

I'm writing a Web API project in C# that uses Entity Framework to pull data from a DB, serialize it and send it to a client. My project has 2 classes, Post and Comment (foreign key from Post). These are my classes. Post class: public partial class…
7
votes
2 answers

Self circular reference in Gson

I'm having some issues to deserialize a Json array that follows this format: [ { "ChildList":[ { "ChildList":[ ], "Id":110, "Name":"Books", "ApplicationCount":0 } ], "Id":110, …
jlordiales
  • 195
  • 1
  • 10
6
votes
1 answer

Why is Swift compiler complaining about circular reference when I comment out seemingly unrelated code?

Creating a brand new macOS Command Line Tool project in Xcode Version 13.3 (13E113), and replacing the contents of main.swift with the following code: import Foundation enum StructA { // case case1(value: StructB) case case2(expr:…
Alex
  • 1,574
  • 17
  • 36
6
votes
1 answer

Most efficient way of finding circular references in list

Given the following list of redirects [ { "old": "a", "target": "b" }, { "old": "b", "target": "c" }, { "old": "c", "target": "d" }, { "old": "d", "target":…
JOSEFtw
  • 9,781
  • 9
  • 49
  • 67
6
votes
1 answer

Remove circular references in dicts, lists, tuples

I have this following really hack code which removes circular references from any kind of data structure built out of dict, tuple and list objects. import ast def remove_circular_refs(o): return ast.literal_eval(str(o).replace("{...}",…
ThomazPom
  • 118
  • 9