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

TimeSpan serialization not working

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      in BsonWriter the if statement is missing an else and thus always falls through to the last else which tries to cast the timespan into a long

      case BsonType.Long:
      if(obj is TimeSpan)
      _writer.Write(((TimeSpan)obj).Ticks);
      if (obj is DateTime)
      Write((DateTime)obj);
      else
      _writer.Write((long)obj);
      return;

      should be

      case BsonType.Long:
      if(obj is TimeSpan)
      _writer.Write(((TimeSpan)obj).Ticks);
      else if (obj is DateTime)
      Write((DateTime)obj);
      else
      _writer.Write((long)obj);
      return;

      Attachments

        Activity

          People

            lanwin Steve Wagner
            matthiasg Matthias Goetzke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: