-
Notifications
You must be signed in to change notification settings - Fork 497
Rename Amazon.Lambda.RuntimeSupport to Amazon.Lambda.RuntimeSupport.TestTool for Lambda Test Tool #2270
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
base: dev
Are you sure you want to change the base?
Conversation
…Support when it is included in the Lambda function. The embedded version of Amazon.Lambda.RuntimeSupport is renamed to Amazon.Lambda.RuntimeSupport.TestTool. aws/integrations-on-dotnet-aspire-for-aws#138
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.
Pull request overview
Work around a .NET assembly resolution conflict between a Lambda function’s Amazon.Lambda.RuntimeSupport dependency and the Lambda Test Tool’s embedded runtime support by publishing/embedding the runtime support assembly under a different name (Amazon.Lambda.RuntimeSupport.TestTool).
Changes:
- Publish embedded RuntimeSupport with
/p:AlternateAssemblyName=Amazon.Lambda.RuntimeSupport.TestTooland update packaging expectations accordingly. - Add
InternalsVisibleTofor the renamed RuntimeSupport assembly and add defensiveMethodAccessExceptionhandling for olderAmazon.Lambda.Coreversions. - Add autover change entries for
Amazon.Lambda.Core,Amazon.Lambda.RuntimeSupport, andAmazon.Lambda.TestTool.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/LambdaTestTool-v2/tests/Amazon.Lambda.TestTool.UnitTests/PackagingTests.cs | Updates packaging assertions to expect the renamed embedded RuntimeSupport artifacts. |
| Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj | Publishes RuntimeSupport with an alternate assembly name for embedding into the test tool package. |
| Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs | Adds defensive handling for MethodAccessException when running with older Amazon.Lambda.Core assemblies. |
| Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj | Adds conditional AssemblyName selection via AlternateAssemblyName. |
| Libraries/src/Amazon.Lambda.Core/Amazon.Lambda.Core.csproj | Grants internals access to the renamed Amazon.Lambda.RuntimeSupport.TestTool assembly. |
| .autover/changes/ed2a6e74-115b-49cd-be5f-ee45da9fa988.json | Declares versioning/changelog updates for the related packages. |
Comments suppressed due to low confidence (1)
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj:55
- The publish output directory is reused (
.../bin/$(Configuration)/%(TargetFrameworks.Identity)/publish). After introducing a new assembly name, a local build can end up with both the oldAmazon.Lambda.RuntimeSupport.*files and the newAmazon.Lambda.RuntimeSupport.TestTool.*files in that folder, and_GetPackageFileswill pack everything underpublish/**/*.*. Consider deleting the publish directory (or publishing to a clean, name-specific directory) before runningdotnet publishso the package can’t accidentally include the oldAmazon.Lambda.RuntimeSupport.dllalongside the renamed assembly.
<Target Name="PublishRuntimeSupportFiles" DependsOnTargets="GetRuntimeSupportTargetFrameworks" BeforeTargets="Build">
<Exec Command="dotnet publish "$(MSBuildThisFileDirectory)../../../../Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" -c $(Configuration) -f %(TargetFrameworks.Identity) /p:ExecutableOutputType=true /p:AlternateAssemblyName=Amazon.Lambda.RuntimeSupport.TestTool" />
</Target>
<Target Name="CopyRuntimeSupportFiles" DependsOnTargets="GetRuntimeSupportTargetFrameworks" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)../../../../Libraries/src/Amazon.Lambda.RuntimeSupport/bin/$(Configuration)/%(TargetFrameworks.Identity)/publish/**/*.*">
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issue #, if available:
aws/integrations-on-dotnet-aspire-for-aws#138
Description of changes:
If the Lambda function includes the NuGet package Amazon.Lambda.RuntimeSupport either directly or indirectly when users setup their launch profile to to point to the embedded version of the assembly in the Lambda test tool the one in the Lambda project ends up being used. This is a .NET runtime issue and we don't have a way to change the load behavior since it is before any of our code is called.
To work around the issue when we publish Amazon.Lambda.RuntimeSupport into the publish out of the Lambda Test Tool we rename the assembly to Amazon.Lambda.RuntimeSupport.TestTool. Going forward users will need to setup the launch profile to say Amazon.Lambda.RuntimeSupport.TestTool and that will avoid any conflicts.
When this is released the AWS Aspire PR must be released: aws/integrations-on-dotnet-aspire-for-aws#153
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.