-
Notifications
You must be signed in to change notification settings - Fork 870
Add error handling for deserialization in dynamo db #3937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the FromDynamoDBEntry
will be called recursively for each property which will trigger the instantiation check do we really need to do a deep inspection. Seems like we will check from the root object if everything in the object hierarchy can be instantiated and then check again at each level down the hierarcy.
let me double check to see if this is the case |
d2b7b4e
to
e9464ca
Compare
e9464ca
to
3fc4399
Compare
this made me take another look at the code and i realized the way i was going about it wrong (although im not sure why it worked?) The latest code now checks during
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves error handling for DynamoDB when users don't provide proper DynamicDependency
attributes for nested objects in Native AOT mode. It replaces silent failures with clear, actionable error messages that guide users on how to fix trimming issues.
- Replaces silent failures with explicit error messages when types cannot be instantiated
- Provides AOT-specific guidance including exact
DynamicDependency
attribute syntax - Adds helpful context about where to place the attributes (constructor, method, etc.)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
sdk/src/Services/DynamoDBv2/Custom/DataModel/ContextInternal.cs | Converts silent failures to informative exceptions with AOT-specific error messages in three type instantiation methods |
generator/.DevConfigs/abdc3b34-805a-44fc-996e-8fa58e021235.json | Adds changelog entry for the DynamoDBv2 error handling improvement |
Description
Update logic for error messaging in DynamoDB when the user does not provide
DynamicDependency
for nested properties when running in native AOT mode.Previously if a user provided something like https://github.com/aws/aws-sdk-net/blob/gcbeatty/dynamotesting/DynamoDBGenericTypeTest/Program.cs#L18 , where they didnt have dynamicdependency for the
List<CarQuoteExcess>
we would throw an error likewhich doesnt really help the user. (The error comes from
aws-sdk-net/sdk/src/Services/DynamoDBv2/Custom/DataModel/ContextInternal.cs
Line 660 in f8e382c
This change updates it so that we check that all nested properties can also be instantiated.
Motivation and Context
#3871
Testing
Ran sample project i made.
I tested by doing different combinations of commenting out
In below test output, i commented out
https://github.com/aws/aws-sdk-net/blob/gcbeatty/dynamotesting/DynamoDBGenericTypeTest/Program.cs
Dry-run
1f12b0c9-7516-4036-8fef-fb967bed2a41
in progressTypes of changes
Checklist
License