Skip to content

Conversation

@normj
Copy link
Member

@normj normj commented Feb 1, 2026

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.

…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
Copy link

Copilot AI left a 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.TestTool and update packaging expectations accordingly.
  • Add InternalsVisibleTo for the renamed RuntimeSupport assembly and add defensive MethodAccessException handling for older Amazon.Lambda.Core versions.
  • Add autover change entries for Amazon.Lambda.Core, Amazon.Lambda.RuntimeSupport, and Amazon.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 old Amazon.Lambda.RuntimeSupport.* files and the new Amazon.Lambda.RuntimeSupport.TestTool.* files in that folder, and _GetPackageFiles will pack everything under publish/**/*.*. Consider deleting the publish directory (or publishing to a clean, name-specific directory) before running dotnet publish so the package can’t accidentally include the old Amazon.Lambda.RuntimeSupport.dll alongside the renamed assembly.
  <Target Name="PublishRuntimeSupportFiles" DependsOnTargets="GetRuntimeSupportTargetFrameworks" BeforeTargets="Build">
    <Exec Command="dotnet publish &quot;$(MSBuildThisFileDirectory)../../../../Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj&quot; -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.

@boblodgett boblodgett requested a review from AlexDaines February 3, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants