Exception when applying BsonRepresentation to ReadOnlyCollection

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.9.1
    • Component/s: Serialization
    • None
    • 🔵 Done
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      If I try do the following:

      [BsonRepresentation(BsonType.ObjectId)]
      public ReadOnlyCollection<string> References { get; private set; }
      

      I get an exception when registering the class:

       

      System.NotSupportedException: A serializer of type 'ReadOnlyCollectionSerializer<String>' is not configurable using an attribute of type 'BsonRepresentationAttribute'

       

      I suspect this is because the ReadOnlyCollectionSerializer does not implement the IChildSerializerConfigurable interface, unlike most other collection serializers. Is there a reason for this?

       

            Assignee:
            Unassigned
            Reporter:
            Taylor Graham
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: