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

BsonDocument.Parse fails for some valid ISODate values

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.3
    • Affects Version/s: 1.11, 2.0.1
    • Component/s: BSON
    • Labels:
      None
    • Environment:
      Windows 2012

      VMware is using Mongo as part of its' Mirage product.
      We are parsing the rs.status() state to keep track of the Mongo health and display this information in our UI.
      As part of the parsing we use BsonDocument.Parse method to parse the relevant rs.status() block.
      This was failing at a customer system:

      ---> System.FormatException: String was not recognized as a valid DateTime format
      in System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style)
      in MongoDB.Bson.IO.JsonReader.ParseISODateTimeConstructor()
      in MongoDB.Bson.IO.JsonReader.ReadBsonType[TValue](BsonTrie`1 bsonTrie, Boolean& found, TValue& value)
      in MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)
      in MongoDB.Bson.Serialization.Serializers.BsonBaseSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)
      in MongoDB.Bson.BsonDocument.Parse(String json)
      in Wanova.Server.Common.MongoServices.MongoShellOperations.ExtractDataFromShell(String result)
      — Fine della traccia dello stack dell'eccezione interna —
      in Wanova.Server.Common.MongoServices.MongoShellOperations.ExtractDataFromShell(String result)
      in Wanova.Server.Common.MongoServices.MongoConfigurer.UpdateReplSetStatus(IList`1 allNode)
      in Wanova.Server.Common.Management.Server.Services.MongoServiceRecoveryTask.UpdateServiceState()

      This caused our system to not recognize the Mongo state correctly.
      After some research we found out this happend because the settings for the time format were: HH.mm.ss
      This caused the exception and parsing to fail.
      We haven't done much additional research as the case is resolved, this is just "FYI"

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            yweinberg@vmware.com Yaniv Weinberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: