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

Unable to explicitly set serializer for recursive enumerable types

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: Serialization
    • Labels:
      None

      Description

      The following Main function will blow up, due to the constructor for ArraySerializer registering a class map for the type before the class map can be registered.

      void Main()
      {
      	BsonClassMap.RegisterClassMap<ModelType>(x => {
      		x.MapMember(y => y.ModelTypes).SetSerializer(new ArraySerializer<ModelType>());
      	});
      }
       
      // Define other methods and classes here
      public class ModelType
      {
      	public ModelType[] ModelTypes { get; set; }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              david@funnelfire.com David Pfeffer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: