-
Notifications
You must be signed in to change notification settings - Fork 864
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
[V4] Support Native AOT trimming for DynamoDB DataModel #3606
Conversation
…odebase to remove the conditional compilation checks and always use either the real trimming attributes or the backported versions.
generator/.DevConfigs/7FE49E8F-93BF-419E-B3B2-265D9D6F35E3.json
Outdated
Show resolved
Hide resolved
@@ -50,22 +48,25 @@ internal class SimplePropertyStorage | |||
public MemberInfo Member { get; protected set; } | |||
// Type of the property | |||
|
|||
#if NET8_0_OR_GREATER | |||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] |
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.
Is changing from PublicParameterlessConstructor
to DataModelModeledType
here intentional?
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.
I can't remember why it was set to PublicParameterlessConstructor
before but since the MemberType
can represent a type from the user and this method relies on methods that also use the DataModelModeledType
I need to make it consistent here.
Description
Building off of the previous #3583 that added Native AOT for DocumentModel this adds support for DataModel.
The changes replaces the
RequiresUnreferencedCodeAttribute
withDynamicallyAccessedMembersAttribute
with theDynamicallyAccessedMemberTypes
parameter set to the required level of reflection needed. Any time the type in question is the POCO used by the callers to represent type theDynamicallyAccessedMemberTypes
is set toAll
since full reflection is required by the library for loading and saving the type.I got tired of adding all of the
#if NET8_0_OR_GREATER
conditional compilations throughout the code when using the trimming attributes likeDynamicallyAccessedMemberTypes
. I backported the trimming attributes into theThirdParty.RuntimeBackports
namespace so I could use the trimming attributes in all targets. As part of this I also removed#if NET8_0_OR_GREATER
added for trimming attributes in Core and the DocumentModel as part of a global search.Because of the S3Link feature that dynamically creates an S3Client I had to extend the
GlobalRuntimeDependencyRegistry
to allow registering the S3 client.Using the following Lambda function using the DataModel library and deployed to Lambda I got the following cold start performances:
Without Native AOT: 1,697 ms
Native AOT: 509 ms
Motivation and Context
#3475
Testing