You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With #168 there was bump for AWSSDK.Extensions.NETCore.Setup from 3.7.1 (2021) to 3.7.300 (2023).
In the interim AWSSDK.Extensions.NETCore.Setup has been marked not trimming safe for Native AoT (aws/aws-sdk-net#3044) with .NET 8.
I think that means, Amazon.Extensions.Configuration.SystemsManager should also be marked not trimming friendly for Native AoT now? Since with .NET 7.0 on-wards IIUC libraries need to opt out of trimming support.
Since there are now trimming warnings when including this package in a NativeAoT application + runtime errors.
Expected Behavior
Amazon.Extensions.Configuration.SystemsManager should not be trimmed since it doesn't support trimming
Current Behavior
Build succeeds with trim warnings,
With package 6.1.0+:
warning IL2104: Assembly 'Amazon.Extensions.Configuration.SystemsManager' produced trim warnings.
here is the same warning with <TrimmerSingleWarn>false</TrimmerSingleWarn>:
ILC : Trim analysis warning IL2026: Amazon.Extensions.Configuration.SystemsManager.Internal.AwsOptionsProvider.GetAwsOptions(IConfigurationBuilder): Using member 'Microsoft.Extensions.Configuration.ConfigurationExtensions.GetAWSOptions(IConfiguration)' which has 'RequiresUnrefer
encedCodeAttribute' can break functionality when trimming application code. The AWSSDK.Extensions.NETCore.Setup package has not been updated to support Native AOT compilations.
There is runtime errors in the application as a result ex:
System.NullReferenceException: Object reference not set to an instance of an object.\n at Amazon.Extensions.NETCore.Setup.ClientFactory.CreateConfig(Type, AWSOptions) + 0x8a\n at Amazon.Extensions.NETCore.Setup.ClientFactory.CreateServiceClient(ILogger, Type, AWSOptions) + 0x8f\n at Amazon.Extensions.NETCore.Setup.AWSOptions.CreateServiceClient[T]() + 0x2c\n at Amazon.Extensions.Configuration.SystemsManager.Internal.SystemsManagerProcessor.<GetParametersByPathAsync>d__6.MoveNex
Reproduction Steps
Sorry, setting a Native AoT project is a little involved, I can cook up a PoC if its really needed.
Include Amazon.Extensions.Configuration.SystemsManager > 6.1.0 in project
I believe that is the actual culprit here (at least with the runtime error I see).
There appears to already be an issue in the core SDK re: trimming problems that reports this: aws/aws-sdk-net#3173
EDIT: Sorry my understanding of trimming was a bit wrong, it was issues with AWSSDK.Extensions.NETCore.Setup that lead to AWSSDK.SimpleSystemsManagement being trimmed out incorrectly, which is why hoisting it up as a root assembly resolves the issue.
@boarnoah I just pushed out a PR AWSSDK.Extensions.NETCore.Setup to make it AOT compatible. That is part of in development V4 of the SDK. aws/aws-sdk-net#3353
Describe the bug
With #168 there was bump for
AWSSDK.Extensions.NETCore.Setup
from3.7.1
(2021) to3.7.300
(2023).In the interim
AWSSDK.Extensions.NETCore.Setup
has been marked not trimming safe for Native AoT (aws/aws-sdk-net#3044) with .NET 8.I think that means,
Amazon.Extensions.Configuration.SystemsManager
should also be marked not trimming friendly for Native AoT now? Since with .NET 7.0 on-wards IIUC libraries need to opt out of trimming support.Since there are now trimming warnings when including this package in a NativeAoT application + runtime errors.
Expected Behavior
Amazon.Extensions.Configuration.SystemsManager
should not be trimmed since it doesn't support trimmingCurrent Behavior
Build succeeds with trim warnings,
With package 6.1.0+:
we now get trim warnings on a successful build:
here is the same warning with
<TrimmerSingleWarn>false</TrimmerSingleWarn>
:There is runtime errors in the application as a result ex:
Reproduction Steps
Sorry, setting a Native AoT project is a little involved, I can cook up a PoC if its really needed.
Possible Solution
I believe we can mark the project with:
https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net8plus#aot-compatibility-analyzers
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Extensions.Configuration.SystemsManager 6.1.0+
Targeted .NET Platform
.NET 8
Operating System and version
AmazonLinux, scratch
The text was updated successfully, but these errors were encountered: