Fix type load issue due to Lambda Response Streaming.#2435
Merged
Conversation
1 task
GarrettBeatty
approved these changes
Jun 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a runtime ReflectionTypeLoadException triggered when customer frameworks scan all loaded types (Assembly.GetTypes()), by removing the problematic response-streaming interface implementation from Amazon.Lambda.RuntimeSupport and relocating the implementation/bridge into Amazon.Lambda.Core.
Changes:
- Moves the
ILambdaResponseStreamimplementation intoAmazon.Lambda.Coreand switches RuntimeSupport to pass a delegate-based bridge object. - Updates RuntimeSupport unit tests to construct the Core-side implementation via shared helpers.
- Adds AutoVer change metadata for patch releases of Core and RuntimeSupport.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/LambdaResponseStreamingCoreTests.cs | Updates tests to use the new helper for creating the Core-side response stream implementation. |
| Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/LambdaBootstrapMultiConcurrencyTests.cs | Removes an unused counter variable/comment in the starvation exploration test. |
| Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/Common.cs | Adds a helper that constructs the Core-side ImplLambdaResponseStream using delegate forwarding. |
| Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/ResponseStreaming/ResponseStreamLambdaCoreInitializerIsolated.cs | Reworks initialization to create the Core-side implementation and register the factory. |
| Libraries/src/Amazon.Lambda.Core/ResponseStreaming/LambdaResponseStreamFactory.cs | Adds new using directives (currently unused). |
| Libraries/src/Amazon.Lambda.Core/ResponseStreaming/ImplLambdaResponseStream.cs | Introduces a new internal Core-side implementation that forwards to delegate callbacks. |
| .autover/changes/f6d458e7-d276-40d2-b1ab-d0c4327e396f.json | Adds patch changelog entries for Core and RuntimeSupport. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…aws-lambda-dotnet into normj/fix-stream-load-issue
dscpinheiro
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
#2430
Description of changes:
As part of the work to add Lambda Response Streaming a new internal type was added to RuntimeSupport that implemented a new interface in Amazon.Lambda.Core. The challenge is at runtime we might have an older version of Amazon.Lambda.Core that doesn't have the interface. Access to the new internal type in RuntimeSupport was covered in defensive checks so that if the interface did not exist at runtime the code would silently ignore the situation and continue. This was fine because if the interface didn't exist then they wouldn't be using Lambda Response Streaming.
The problem is if the user used a framework that scanned all types across assemblies like the following code
That would fail because skips RuntimeSupport's defensive checks and attempts to load the internal type from RuntimeSupport. Since the interface that the type declares it implements doesn't exist the runtime fails to load and then throws an exception.
This fix address the issue by no longer having a type in RuntimeSupport that has the interface in it's inheritance hierarchy. Instead I moved the implementation to
Amazon.Lambda.Coreand then pass through internal channels the collection of delegates from RuntimeSupport to Core so that the implementation in Core can forward on the logic into RuntimeSupport.Testing
Updated the tests and they were successful. I also recreated the customer issue by deploying with specific assembly versions and not NuGet packages using the executable programming model. Once I had recreated the failure I swapped out only this version of RuntimeSupport keeping the same version of Core that caused the problem and the Lambda function ran correctly.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.