I am trying to debug xml serialization. During xml serialization, the serializer "detected a circular reference". I'd like to find it and get rid of it. Is there some convenient tool / approach that I can use?
Usually it is pretty obvious with manual inspection...
You might try serialising to a file, and just look at the end of the file - it won't be complete XML, obviously, but it should give a clue.
Note that DataContractSerializer
is capable (by enabling an option) of serialising complete graphs, but it has less XML options than XmlSerializer
has - and graph mode is even less XML-like; IMO removing the cycle is preferable. Usually this is just a case of something like:
[XmlIgnore]
public Person Parent {get;set;}
(i.e. serialize "downwards" references only)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With