I am trying to send complex objects using EasyNetQ but I keep running into this exception because my object contains a list of child objects that reference back to the parent object:
Self referencing loop detected for property 'Parent' with type 'Domain.ParentItem'.
Path 'Entity.Children[0]'."}
I have tried changing the JSON.NET default settings like so, but it doesn't fix the issue:
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.Indented,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
How can I change the default settings of the Json serializer so I can get around this issue without having to create separate DTO objects?
Edit: I have tried the suggestions in the possible duplicate (as I put in my original post) and it did not solve the issue.