Improve log message when waiting for an endpoint to be allocated#15474
Improve log message when waiting for an endpoint to be allocated#15474adamint merged 1 commit intomicrosoft:mainfrom
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15474Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15474" |
There was a problem hiding this comment.
Pull request overview
Improves the “waiting for value” log output during runtime value resolution by providing a more specific message when the unresolved value is an EndpointReference (or EndpointReferenceExpression), addressing #13912.
Changes:
- Add a specialized log message for unresolved endpoint references (includes endpoint name, resource name, and network ID when present).
- Introduce a helper (
TryGetEndpointReference) to extract anEndpointReferencefrom eitherEndpointReferenceorEndpointReferenceExpression.
| logger.LogInformation( | ||
| "Waiting for endpoint '{EndpointName}' on resource '{ResourceName}' for the '{NetworkName}' network", | ||
| endpointReference.EndpointName, | ||
| endpointReference.Resource.Name, | ||
| endpointReference.ContextNetworkID?.Value); |
There was a problem hiding this comment.
The logged network name is taken only from endpointReference.ContextNetworkID. If ContextNetworkID is null (the common case), the message will log a null/empty network even though endpoint resolution actually uses ValueProviderContext.GetNetworkIdentifier() (caller default network) in EndpointReferenceExpression.GetValueAsync. Consider logging the same effective network context used for resolution (e.g., endpointReference.ContextNetworkID ?? valueProviderContext.GetNetworkIdentifier()), or adjust the message to omit the network portion when it’s not explicitly set.
Description
Improve log message when waiting for an endpoint to be allocated.
Previously it would have said
Now it says
Fixes #13912
If you want to reproduce this, easiest way is to use an endpoint reference on a network aspire doesn't know about:
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: