EndpointReference evaluation should wait on missing AllocatedEndpoint#13074
EndpointReference evaluation should wait on missing AllocatedEndpoint#13074
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13074Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13074" |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where EndpointReference evaluation would return null immediately when an AllocatedEndpoint for a specific network context was missing, instead of properly waiting for it to be allocated. The fix ensures that a ValueSnapshot is created and added to the collection for the missing network context, so that the evaluation will wait (as intended) until the endpoint is allocated.
Key Changes:
- Modified
EndpointReferenceExpression.GetValueAsync()to create a newNetworkEndpointSnapshotwith an emptyValueSnapshotwhen no snapshot exists for the requested network context, enabling proper waiting behavior - Added a test to verify that expression resolution waits (and times out) when an allocated endpoint for a specific network context is missing
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 logic to create and add a NetworkEndpointSnapshot with an empty ValueSnapshot when none exists for the network context, instead of returning null immediately |
| tests/Aspire.Hosting.Tests/ExpressionResolverTests.cs | Added test ExpressionResolutionShouldWaitOnMissingAllocatedEndpoint and helper class TestHostResource to verify the fix works correctly |
|
/backport to release/13.0 |
|
Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19548391113 |
|
@karolz-ms backporting to "release/13.0" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Patch format detection failed.
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
…#13074) * Expression resolver should wait on missing AllocatedEndpoint(s) * Target test now passing * ExpressionResolverTests passing
Fixes #12823
This was my mistake when implementing context-aware EndpointReference evaluation