question-mark
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.

Circular dependencies detection problem 2

See original GitHub issue

Continuation of https://github.com/ExtendedXmlSerializer/home/issues/583

I have new case of same problem Looks like this problem have more shades. Problem found unexpectedly, previously we use .EnableReferences() but soon as we switched to .AllowMultipleReferences() new problem is occured. If I EnableReferences for same object it will serialize successfully, but will never use exs:reference="1"exs:identity=“1” I suppose this object should serialize with .AllowMultipleReferences only Even Array.Empty<string> will be detected as MultipleReferences

using ExtendedXmlSerializer;
using ExtendedXmlSerializer.Configuration;

var sameInnerObject = new InnerObject { Id = 100, Items = new string[] { } };
var testRootObject = new RootObject
{
    Item1 = sameInnerObject,
    Item2 = new InnerObject2 { Items = sameInnerObject.Items },
    List = new List<InnerObject>()
};

IExtendedXmlSerializer serializer = new ConfigurationContainer()
    .AllowMultipleReferences()
//.EnableReferences() 
    .Create();
var serialized = serializer.Serialize(testRootObject);
Console.WriteLine("Success");

public class RootObject
{
    public InnerObject Item1 { get; set; }
    public InnerObject2 Item2 { get; set; }
    public List<InnerObject> List { get; set; } = new();
}

public class InnerObject
{
    public int Id { get; set; }
    public string[] Items { get; set; }
}

public class InnerObject2
{
    public string[] Items { get; set; }
}

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
UladimirLameykocommented, Jan 9, 2023

@Mike-E-angelo Look like it helps on my side. Currently it is not generating Exceptions. Thanks. Please push it into nuget😎

1reaction
Mike-E-angelocommented, Jan 9, 2023

Oh I see… are you saying this is throwing a CircularReferencesDetectedException instead of a MultipleReferencesDetectedException? I can look into that if so. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix nasty circular dependency issues once and for ...
Fix attempt 1. So, it turns out that our circular dependency causes a nasty problem. However, if we look closely it is pretty...
Read more >
How do I detect circular logic or recursion in a multi-levels ...
One way to detect circular dependency is to keep a record of the length of the dependency chains that your ordering algorithm detects....
Read more >
My Experience with Circular Dependencies in JavaScript
Detecting circular dependencies can be challenging, especially in larger codebases. Here are some common signs to look out for: Error messages ...
Read more >
Circular Dependencies in Spring
A circular dependency occurs when a bean A depends on another bean B, and the bean B depends on bean A as well:...
Read more >
Circular dependencies detection do not exclude tests in ...
I write a test for the first library, in this test, I import the second library and the tests works properly but if...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found