Priority: Major - P3
Resolution: Gone away
Affects Version/s: 2.11.4
Fix Version/s: None
It looks like BsonSerializer fails to resolve proper serializer for a member when declared member type doesn't match actual initialized type.
Observed code flow (might not be exact):
- BsonMemberMap looks up serializer and calls .Serialize() on found serializer (via extension method I believe).
- Matched serializer of type ClassSerializerBase<T> calls Serialize() method on base class.
Serialize() method looks up serializer on actual runtime type (e.g. value.GetType()) which fails to find serializer for a concrete type.
If you register concrete type serializer as well, driver fails with StackOverflow exception because of infinite serializer lookup loop.
Please take a look at minimal repro below.