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

ObjectId.GenerateNewId() Generates Invalid Id Randomly

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • None
    • BSON
    • None

    Description

      There seems to be a moment in a day or every few days, where the ObjectId.GenerateNewId() generates a 23 length ID, and fails to Parse.
      We noticed this error live, and I was able to reproduce this error in leaving a test running all day, where i would call ObjectId.GenerateNewId(), and parse it to an ObjectId. It seems to randomly return a 23 length ID at different times on different days, which of course wont parse.

      The error and a sample Invalid id:
      System.FormatException: '590262767c771f2b986a59b' is not a valid 24 digit hex string.
      at MongoDB.Bson.ObjectId.Parse(String s)

      Attachments

        1. screenshot-1.png
          screenshot-1.png
          75 kB
        2. screenshot-2.png
          screenshot-2.png
          44 kB

        Activity

          People

            robert@mongodb.com Robert Stam
            dcameron Dale Cameron
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: