[CSHARP-2889] BsonClassMap.LookupClassMap supports private constructors inconsistently Created: 31/Dec/19 Updated: 28/Oct/23 Resolved: 17/Jan/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 2.10.0 |
| Fix Version/s: | 2.10.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Gennady Andreev | Assignee: | Dmitry Lukyanov (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||
| Description |
|
For a derived type with private parameterless constructor, BsonClassMap.LookupClassMap works fine if it introduces new properties, but throws an exception if it does not (example in the attachment). It seems to me the method should work fine in both cases. |
| Comments |
| Comment by Robert Stam [ 17/Jun/20 ] |
|
As part of fixing this issue we now correctly identify some immutable classes that we didn't use to correctly identify as immutable. Because immutable classes are deserialized differently than mutable classes (specifically: immutable classes will only be instantiated by calling a constructor) the changes in this ticket can result in slightly different behavior from before when deserializing documents that are missing fields. See |
| Comment by Githook User [ 17/Jan/20 ] |
|
Author: {'username': 'DmitryLukyanov', 'name': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com'}Message: |
| Comment by Githook User [ 17/Jan/20 ] |
|
Author: {'name': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com', 'username': 'DmitryLukyanov'}Message: |