Check for TypeConverters on serialization/deserialization when no explicit serializer present

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.7.2
    • Component/s: None
    • None
    • Environment:
      All: .NET Core - Windows, Linux, & OSX
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently it seems like the MongoDB C# driver doesn't support any aspect of the notions of .NET TypeConverters

      If a type has a TypeConverter configured and can serialize to and from strings it makes a whole heck of a lot of sense to simply use the type converter out of the box to perform the conversions.  This is what JSON.NET does and it is "especially" true when using a type like this as a key in a dictionary which implicitly has to be a string.

      When I feed a dictionary keyed by a type with a type converter I get this error in the driver...

      MongoDB.Bson.BsonSerializationException
      HResult=0x80131500
      Message=When using DictionaryRepresentation.Document key values must serialize as strings.
      Source=MongoDB.Bson

      If you just leverage the configured type converter it will yield back the string and you can continue on your merry way rather than me having to set explicit mongo specific serializers for each type which is a pain.

            Assignee:
            Robert Stam
            Reporter:
            Brian Buvinghausen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: