Describe the feature
When an AWS SDK library has a dependency to another one, it resolves it either by using the GlobalRuntimeDependencyRegistry class, or by performing some reflection. The former method exists because the reflection employed is not compatible with trimming or Native AOT.
However, it is possible to use trim-friendly reflection patterns (centered arround passing a string literal to Type.GetType(string)), and eliminate the need for GlobalRuntimeDependencyRegistry.
Use Case
- Reduce barriers of using the AWS SDK with trimming or Native AOT.
- Increase reliability and trim-safety, by reducing the amount of
UnconditionalSuppressMessageAttribute uses.
- Simplify the codebase.
Proposed Solution
- Add new overloads to
ServiceClientHelpers methods, that accept a single string parameter with the type's assembly-qualified name (e.g. Amazon.SecurityToken.AmazonSecurityTokenServiceClient, Amazon.SecurityToken), and appropriately annotate them so that the trimmer keeps these types.
- Update code to use these overloads.
- Remove
[UnconditionalSuppressMessage] where no longer necessary.
- Obsolete all methods of
GlobalRuntimeDependencyRegistry, suggesting that they are no longer necessary to call, and guide users to just reference the respective NuGet package.
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Core V4
AWSSDK.DynamoDBv2 V4 (for its S3 Link feature)
Targeted .NET Platform
All supported frameworks, particularly modern .NET with trimming or NativeAOT
Operating System and version
All supported operating systems
Describe the feature
When an AWS SDK library has a dependency to another one, it resolves it either by using the
GlobalRuntimeDependencyRegistryclass, or by performing some reflection. The former method exists because the reflection employed is not compatible with trimming or Native AOT.However, it is possible to use trim-friendly reflection patterns (centered arround passing a string literal to
Type.GetType(string)), and eliminate the need forGlobalRuntimeDependencyRegistry.Use Case
UnconditionalSuppressMessageAttributeuses.Proposed Solution
ServiceClientHelpersmethods, that accept a single string parameter with the type's assembly-qualified name (e.g.Amazon.SecurityToken.AmazonSecurityTokenServiceClient, Amazon.SecurityToken), and appropriately annotate them so that the trimmer keeps these types.[UnconditionalSuppressMessage]where no longer necessary.GlobalRuntimeDependencyRegistry, suggesting that they are no longer necessary to call, and guide users to just reference the respective NuGet package.Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Core V4
AWSSDK.DynamoDBv2 V4 (for its S3 Link feature)
Targeted .NET Platform
All supported frameworks, particularly modern .NET with trimming or NativeAOT
Operating System and version
All supported operating systems