BsonSerializer RegisterSerializer should validate serializer argument

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Serialization
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      The untyped overloads of RegisterSerializer can't catch type mismatches at compile time. They are currently not being caught at runtime either, and mismatches result in difficult to diagnose errors later on when the driver attempts to use the mismatched serializer.

      For example, the following should be a runtime error:

      var xserializer = new XSerializer();
      BsonSerializer.RegisterSerializer(typeof(Y), xserializer);
      

            Assignee:
            Unassigned
            Reporter:
            Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: