Details
-
Bug
-
Resolution: Fixed
-
Unknown
-
None
-
None
-
None
-
Fully Compatible
Description
If an object has an Id property without a getter, attempting to serialize it to json will throw a NullReferenceException. This is caused by not checking if `GetMethod` is null here: https://github.com/mongodb/mongo-csharp-driver/blob/c8e76e5dd3c11683b5d99f56374754eb1e7ec792/src/MongoDB.Bson/Serialization/Conventions/NamedIdMemberConvention.cs#L114-L118.
I've attached a trivial repro that you can run and test locally.