-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.7
-
Component/s: None
-
None
When serializing BsonValues we don't call LookupSerializer for the different serializers needed, we use static instances for performance reasons (no locking contention, no dictionary lookup).
Therefore, we should throw an exception if an attempt is made to register a serializer for any of the BsonValue subclasses, since they won't be used anyway and allowing them to be registered is misleading.
We do this partially now (you can't register a serializer for BsonDocument), but we need to do it for all BsonValue subclasses.