[release/13.0] EndpointReference evaluation should wait on missing AllocatedEndpoint (#13074)#13076
Merged
joperezr merged 1 commit intorelease/13.0from Nov 24, 2025
Merged
Conversation
…#13074) * Expression resolver should wait on missing AllocatedEndpoint(s) * Target test now passing * ExpressionResolverTests passing
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13076Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13076" |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug where EndpointReference evaluation would incorrectly resolve as an empty value instead of waiting for a missing AllocatedEndpoint. This change restores the proper asynchronous waiting behavior, preventing potential failures in applications and tests that depend on endpoint resolution.
Key Changes:
- Modified
EndpointReferenceExpression.GetValueAsyncto create and wait on aValueSnapshot<AllocatedEndpoint>when no snapshot exists for the requested network context, instead of immediately returning null - Added thread-safe handling using
TryAddto prevent race conditions when multiple threads attempt to create snapshots for the same network - Included comprehensive test coverage to verify the fix works correctly
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Hosting/ApplicationModel/EndpointReference.cs | Fixed the endpoint resolution logic to create and wait on a ValueSnapshot instead of returning null when no AllocatedEndpoint exists for the requested network context |
| tests/Aspire.Hosting.Tests/ExpressionResolverTests.cs | Added test ExpressionResolutionShouldWaitOnMissingAllocatedEndpoint to verify the fix, along with a minimal TestHostResource helper class |
joperezr
approved these changes
Nov 24, 2025
davidfowl
approved these changes
Nov 24, 2025
This was referenced Nov 26, 2025
Merged
Merged
This was referenced Dec 24, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
A fix to restore proper EndpointReference resolution behavior, which should wait on missing AllocatedEndpoint instead of resolving as empty value. This bug can break existing applications and tests.
Fixes #12823
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate