Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-417

BsonArray doesn't support null values

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.4.1
    • 1.4
    • None

    Description

      Looking at the source code for BsonArray.cs, there are numerous places where null values in the array will cause a crash.

      line 676:
      clone.Add(value.DeepClone());

      line 722:
      hash = 37 * hash + value.GetHashCode();

      line 818:
      sb.Append(_values[i].ToString());

      line 833:
      _values[i].WriteTo(bsonWriter);

      ..and I'm sure there are other places!

      To reproduce: deserialize some JSON with a null in an array, then try adding to Mongo with the driver.

      My understanding is that null values are valid JSON and valid BSON, so should be supported by Mongo and the C# driver.

      I'm happy to work on this - but am too busy this week.

      Thanks,
      Ben

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            benblamey Ben Blamey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: