DynamoDBv2 DynamoDBContext.FromDocument - Inconsistent deserialization in .NET Framework and .NET Standard #1848
Labels
breaking-change
This issue requires a breaking change to remediate.
bug
This issue is a bug.
dynamodb
p2
This is a standard priority issue
queued
Description
When using DynamoDBContext to deserialize to an object with FromDocument or FromQueryAsync it will populate private properties in .Net standard but ignore them in .Net Framwork 4.5.
Reproduction Steps
If we take the following classes
And use DynamoDBContext to either context.FromQueryAsync() or context.FromDocument(doc)) it will populate all of the members above in .NET standard but only the public members in .NET Framework.
I personally prefer the .NET standard implemenation of populating all members (private/protected/public).
Logs
Environment
Resolution
The issue is with the GetMembers() method in Amazon.Util.Internal.TypeFactory in the Core library.
The .NET Framework version does a simple
while the .NET standard version has a custom implemenation of the above using a GetMembers_Helper() private method.
Changing the .NET Framwork version of GetMembers() to:
Would give more consistent results but may introduce a breaking change for some applications. A cleaner way might be allow a user to override the members flags in the DynamoDBContextConfig and defaulting to the current method.
Let me know if you would like any more details or any input into a potential fix.
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: