Document potential stack overflow in BsonValue.Create() and similar methods dealing with collections

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 1.4.1
    • Affects Version/s: 1.4
    • Component/s: None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Here is the code that never ends (crashes at some point) because of a cyclic reference:

      var list = new System.Collections.Generic.List<object>();
      list.Add(list);
      var bson = MongoDB.Bson.BsonValue.Create(list);

      Is this a known issue?

      This is not a practical use case, indeed. Collections with recursion are more likely created by mistake, at least in our database related context.

      I do not think this should be fixed. But I propose to document this issue. Users should be informed and aware of this. The example above is silly, cyclic references may be much more subtle in practice.

              Assignee:
              Robert Stam
              Reporter:
              Roman Kuzmin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: