Serialization problems with version 2.19+

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=, 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"));

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.

Make sure you’re registering


only once around your code base.

I checked it. :frowning:
Search for “ObjectSerializer” in hole solution

Seems like your app is trying to add the serializer twice. You could use this line


instead of