I am trying to serialize an object (specifically the distance object in the UnitClassLibrary dropdown ). Since, apparently, this library does not support serialization, I am ready to change it for my own purposes.
However, I am not sure how to diagnose this problem that occurs. I get the following error when trying to serialize an object using JSON.net (I also tried serializing the XML using the built-in tools and getting similar errors).
Additional information: Self referencing loop detected for property 'EqualityStrategy' with type 'UnitClassLibrary.DistanceEqualityStrategy'. Path ''.
However, I cannot find any self-regulation loop in the code for the Distance object. How can I diagnose this problem?
I'm currently just trying to serialize as follows:
Distance newDistance = new Distance();
var json = JsonConvert.SerializeObject(newDistance);
This leads to an error. I can change the library that I use, but I don't have one.
Jake source
share