Skip to content
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

Add warning about possible trimmed nested types for DataModel #3668

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

normj
Copy link
Member

@normj normj commented Feb 24, 2025

Description

For the Native AOT support with the Object Persistence Model high level library for DynamoDB we used the DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All). That assumed by using DynamicallyAccessedMemberTypes.All for the type being used with the library nothing for that type would be trimmed. It is possible for nested types referenced by the type being used with DynamoDB it is possible they could be trimmed. That seems surprising behavior that needs investigating but for the now the work around is for users wanting to use Native AOT and run into this problem is to add the [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(<nested-type>))] in some method or constructor or code that is for sure not being trimmed.

To help users know they need to do this when this situation arises the error message for when we can't instantiate an object has been updated to give them direction on adding the attribute.

Motivation and Context

#3646

Testing

Since the problem only happens with Native AOT I relied on manually testing. I recreated the problem by deploying a Lambda function using Native AOT and got the expected error message. Then followed the error message's direction of adding the DynamicDependency on the constructor of the parent type and redeployed. The redeployed version was successful

@normj normj force-pushed the normj/ddb-aot-message branch from 6b1c6ea to a51f3a5 Compare February 24, 2025 02:28
@normj normj added the v4 label Feb 24, 2025
@normj normj merged commit dbc7589 into v4-development Feb 24, 2025
1 check passed
@normj normj deleted the normj/ddb-aot-message branch February 24, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants