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

DateTimeSerializer with different Tick count when deserializing

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 2.10.2
    • Serialization
    • None
    • Win10

    Description

      Using the DateTimeSerializer the tick count differs when deserializing a DateTime object:

      DateTimeSerializer.LocalInstance.Serialize(context, args, aDateTime);
      var decodedDateTime = DateTimeSerializer.LocalInstance.Deserialize(context, args);

      The deserialized DateTime object is equal to the original except for the Tick count which differs by some nanoseconds (this is reproducable and it's always the last 4 digits of the tick count that differ). Here is one Xunit exception message:

      Xunit.Sdk.EqualException: "Assert.Equal() Failure
      Expected: 2020-03-06T09:54:09.6356673+01:00
      Actual:     2020-03-06T09:54:09.6350000+01:00

       

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            skharchi@xion-medical.com Samir Kharchi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: