Open boarnoah opened 3 weeks ago
Needs review with the team.
Did some more testing excluding various assemblies (that are transitive deps from this) from trimming,
Was able to eliminate runtime errors with:
<ItemGroup>
<TrimmerRootAssembly Include="AWSSDK.SimpleSystemsManagement" />
</ItemGroup>
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: https://github.com/aws/aws-sdk-net/issues/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. https://github.com/aws/aws-sdk-net/pull/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 (https://github.com/aws/aws-sdk-net/pull/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