-
Notifications
You must be signed in to change notification settings - Fork 745
[release/13.0] EndpointReference evaluation should wait on missing AllocatedEndpoint (#13074) #13076
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
Conversation
…#13074) * Expression resolver should wait on missing AllocatedEndpoint(s) * Target test now passing * ExpressionResolverTests passing
|
🚀 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" |
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
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 |
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