With release 2.19.0 we now have to register our types in order for them to be serialized. The suggestion in the release notes here is to do the following…
var objectSerializer = new ObjectSerializer(type => ObjectSerializer.DefaultAllowedTypes(type) || type.FullName.StartsWith("MyNamespace"));
This works, however, at the company I work we explicitly register all our types using BsonClassMap.RegisterClassMap<T>(...) to avoid accidents when serializing/deserializing. Given that we’re already being explicit about the types we want registered could the library note these types and add them to the allowed types automatically.
I did update our test suite to use the latest client, and then switched towards using the correct type-based overloads on the serializer.
our code already adds the mappings here
and then all our tests passed which previously they didn’t so I was assuming it somehow already makes the serializer “aware” of the types. That being said, it might also “just” work because internally in the client, there are many different serializer types that are being used.