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

Unable to explicitly set serializer for recursive enumerable types

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.1
    • Affects Version/s: 2.0
    • Component/s: Serialization
    • None

      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; }
      }
      

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

              Created:
              Updated:
              Resolved: