I fight with the serialitation of a list after updating my driver at 2.22.0.
I got this exception:
Type System.Collections.Generic.List`1[[MyNameSpace.Entity, MyNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] is not configured as a type that is allowed to be serialized for this instance of ObjectSerializer.
I saw the release notes for 2.19.0 and add this to my code:
var objectSerializer = new ObjectSerializer(type => ObjectSerializer.DefaultAllowedTypes(type) || type.FullName.StartsWith("MyNamespace"));
BsonSerializer.RegisterSerializer(objectSerializer);
And got this exception:
MongoDB.Bson.BsonSerializationException : There is already a serializer registered for type Object.
Could you please help me understand what I am doing wrong here?
Thank you for your time and support.