[CSHARP-2541] when using inherentence of classes and hiding class members a serialization exception occurs with duplicate property name Created: 08/Mar/19  Updated: 27/Oct/23  Resolved: 19/Mar/19

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.7.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Martien Poels Assignee: Robert Stam
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

c#, windows, server running mongo atlas


Issue Links:
Duplicate
is duplicated by CSHARP-2549 Shadowing/Hidden properties causing B... Closed

 Description   

if you have nested classes that need to be overriden you normally will use the keyword new to hide base properties. But if you do that the serializer complains about duplicate property names. The message it gives is correct but in the supplied case this is not a problem but the intention todo so. Sample and details are in stackoverflow

https://stackoverflow.com/questions/55069966/bson-does-not-serialize-with-new-overridden-attributes-and-reports-duplicate-u



 Comments   
Comment by Robert Stam [ 19/Mar/19 ]

See the comments on CSHARP-2549 for why we don't support this.

Generated at Wed Feb 07 21:42:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.