-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle circular references #43
Comments
Hey! I'm not sure what could be the best solution here. Ignoring them, throwing that exception... Anyway, is this throwing exceptions? Probably I'm mistaken, but TrackerDog independently handles each property change. |
Currently, it does not throw an exception. It just runs into that cycle and never returns (until program is out of memory). Potential solution: The user could provide an error callback that is called when a circular references is detected. But in each case a continuous check for circular references could be time consuming, wouldn't it? Maybe, it is just a bad design in client's code (my) to allow potential circular references, e.g., tracking changes in a doubly linked list. |
@mr-at0s It shouldn't be a bad design per se, because usually when you implement an public class Foo
{
public IList<Bar> Bars { get; set; }
}
public class Bar
{
public Foo Foo { get; set; }
} Maybe a possible solution could be ignoring them with some attribute: public class Foo
{
public IList<Bar> Bars { get; set; }
}
public class Bar
{
[IgnoreDataMember]
public Foo Foo { get; set; }
} Actually What do you think about this? |
Also, maybe the whole TrackerDog's configuration API could provide something like track this but (some given properties). |
Yes, |
Do you need this feature already? |
Yes, but the performance issue (see #45) has got higher priority for us. |
I see. Are you woking in a .NET Core app? |
No, these are standard Windows .Net Framework projects. |
Some objects may have circular references. How should we handle this? Maybe, throwing an exception if someone is registering such an object? Or any idea on this?
The text was updated successfully, but these errors were encountered: