I'm getting a stack overflow exception when I try to serialize an object to bson, json, bsondocument. The class has references to its outer class and outer class references to its inner class. What is the way to fix this issue? The object graph has a lot of references up and down the object chain?
BsonClassMap.RegisterClassMap<Document>();
BsonClassMap.RegisterClassMap<Section>();
Document _document = GetDocument();
BsonDocument _bsondocument1 = _document.ToBsonDocument();
string _hello4 = _documents[0].ToJson();
Class Section has reference to Document and Document has Sections.
Thanks for your help.