You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show resources waiting for parameters during startup - #22291
Resources blocked on missing parameter values now show Unresolved parameters and identify the parameters they are actually waiting for, instead of appearing stuck during startup. The list updates as values become available, including when a read happens before the resource reaches Starting.
This is an independently implemented alternative to #18896, based on main. It observes incomplete ParameterResource.GetValueAsync(ValueProviderContext, CancellationToken) calls and attributes them to ValueProviderContext.Caller; it does not predict dependencies by walking the resource model.
Behavior and implementation
Reference-count concurrent reads per caller instance so completing or canceling one read cannot clear another active wait. Only parameters actually read are reported, including reads inside opaque callbacks and conditional expressions.
Restore the previous startup state, including an unset state, after the last read finishes without overwriting newer lifecycle updates or replacing an active dependency wait.
Treat unresolved-parameter waits as startup for Start, Stop, and Restart command availability.
Forward value-provider context through startup configuration, connection strings and properties, Dockerfile arguments and secrets, certificate passwords, URL expressions, and integration configuration callbacks.
Add IResourceWithConnectionString.GetConnectionStringAsync(ValueProviderContext, CancellationToken). Its default implementation calls the existing context-free resolver for compatibility with custom resources whose runtime connection string differs from their expression.
Have built-in connection-string resources explicitly forward context, including parent/child resources, connection-string parameters, and redirects. Third-party resolvers can opt in by implementing the contextual overload.
Resolve connection strings contextually in dashboard publication and the early PostgreSQL, Redis, and SQL Server callbacks. Missing passwords are attributed before those callbacks block startup; the existing event ordering is unchanged.
Keep localhost networking for dashboard display values and host-side integration clients, independently of the caller used for parameter attribution.
Track parameter names, not values. Context-free reads and publish-mode reporting retain their existing behavior. No dependencies are added or updated.
User-facing usage
No extra configuration is required for ordinary parameter references:
While postgres-password is missing, postgres reports KnownResourceStates.UnresolvedParameters and the dashboard identifies the missing parameter. Supplying the value allows startup to continue.
Custom startup callbacks and nested value providers get the same attribution by forwarding a ValueProviderContext containing the execution context and requesting resource to GetValueAsync.
Custom connection-string resources can implement the new contextual overload:
Resolvers with custom runtime behavior should retain that behavior and forward the context to any nested value providers. Existing implementations that only provide GetConnectionStringAsync(CancellationToken) continue to work, but do not gain contextual parameter attribution automatically.
Screenshots / Recordings
The branch-built dashboard showing parameter reads made inside an opaque environment callback:
Validation
739 targeted tests passed on the current changes. Quarantined and outerloop tests were excluded.
All 33 affected Hosting projects were also compiled together using a temporary validation solution, which was removed afterward. The build succeeded with an existing MySqlConnector vulnerability warning; dashboard validation also reported an existing Microsoft.Extensions.Validation advisory.
Regression coverage includes the real pre-start connection-string event sequence, missing database passwords, legacy custom resolvers with unused unresolved expressions, contextual redirects, caller attribution, concurrent reads, cancellation/failure, lifecycle-state restoration, and localhost display values.
Earlier manual validation built and started an isolated, no-container AppHost using the branch's Hosting and Dashboard builds. Ordinary environment references and an opaque callback reported their actual pending parameters. Supplying api-key reduced the callback's list from api-key, region to region; supplying region let both executables finish successfully with exit code 0. The demo was stopped and removed.
The full test suite was not run.
Fixes # (issue)
Checklist
Is this feature complete?
Yes. Ready to ship.
No. Follow-up changes expected.
Are you including unit tests for the changes and scenario tests if relevant?
Yes
No
Did you add public API?
Yes
If yes, did you have an API Review for it?
Yes
No
Did you add <remarks /> and <code /> elements on your triple slash comments?
Yes
No
No
Does the change make any security assumptions or guarantees?
Yes
If yes, have you done a threat model and had a security review?
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Outstanding endpoint-resolution and startup-state bugs can produce host-inaccessible dashboard URLs, suppress missing-parameter reporting, and enable Stop/Restart commands that remain pending.
This PR adds runtime tracking of unresolved parameter reads so Aspire can identify which parameters are blocking resource startup. Unlike the relationship-based approach in #18896, it follows actual value resolution, including callbacks that forward caller context.
Changes:
Tracks concurrent parameter waits and restores prior startup states as reads complete.
Propagates caller context through value providers and integration configuration.
Adds dashboard warning details, localization resources, and focused regression tests.
File
Description
tests/Aspire.Hosting.Tests/AddParameterTests.cs
Tests wait tracking, cleanup, state preservation, and caller attribution.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues break host-facing endpoint resolution, obscure unresolved parameters after dependency waits, and enable Stop/Restart commands that can hang during startup.
Adding Caller without Network makes container endpoint expressions resolve to container DNS names and target ports, so dashboard links become inaccessible from the host browser and published connection properties disagree with the host-facing connection string. Keep caller attribution but explicitly set Network = KnownNetworkIdentifiers.LocalhostNetwork for these host-facing resolutions. Apply the same fix in src/Aspire.Hosting/ApplicationModel/ResourceUrlsEditor.cs:15 and src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:89.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Startup can still block on untracked connection-string reads, while build-argument resolution changes existing values and wait-state handling can hide unresolved parameters and dependency controls.
If a parameter read changes Starting to UnresolvedParameters before dependency waiting begins, CanTransitionToWaiting rejects the new state, so dependency details and the force-start command remain unavailable. Add state == KnownResourceStates.UnresolvedParameters to CanTransitionToWaiting at line 670, and cover a parameter read that begins before dependency waiting is entered.
Keep build-argument endpoint resolution on the localhost network
src/Aspire.Hosting/Dcp/ContainerCreator.cs:620
Adding Caller without specifying Network also changes existing build-argument resolution: GetNetworkIdentifier() now selects the container network instead of localhost. For example, an endpoint supplied as a build argument for a browser-facing API URL changes from http://localhost:<host-port> to a Docker-only hostname and target port, leaving the generated frontend pointing at an unreachable address. Set the network explicitly to LocalhostNetwork here to preserve the previous resolution behavior while adding wait attribution.
Preserve custom connection-string resolution for contextual build args
src/Aspire.Hosting/Dcp/ContainerCreator.cs:627
When an IResourceWithConnectionString is passed through WithBuildArg(string, object), the contextual overload resolves ConnectionStringExpression instead of calling its custom GetConnectionStringAsync, potentially supplying a different build value. Preserve custom connection-string resolution while adding caller attribution, and add a regression test where the custom resolver returns a different value from the expression.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Parameter-read-first ordering and context-free initial connection-string resolution leave waits unreported, with the former also preventing the Start command from bypassing dependency waits.
Resolve connection-string expressions with caller context for environment variables and arguments. Leave direct and lifecycle resolution unchanged.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new connection-string overloads can break existing callers through ambiguity and bypass custom subclass resolvers, while persistent PostgreSQL resources fail to expose active password waits after manual Start.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because persistent explicit-start resources can appear idle during initialization or startup, hiding pending parameter waits and potentially re-enabling Start prematurely.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because mixed-inheritance resolver dispatch can bypass custom runtime logic, causing dashboard publication to return an incorrect connection string or block.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because contextual connection-string resolution may bypass existing subclass resolvers, risking incorrect connection strings or blocked startup.
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
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
Resources blocked on missing parameter values now show Unresolved parameters and identify the parameters they are actually waiting for, instead of appearing stuck during startup. The list updates as values become available, including when a read happens before the resource reaches Starting.
This is an independently implemented alternative to #18896, based on main. It observes incomplete
ParameterResource.GetValueAsync(ValueProviderContext, CancellationToken)calls and attributes them toValueProviderContext.Caller; it does not predict dependencies by walking the resource model.Behavior and implementation
IResourceWithConnectionString.GetConnectionStringAsync(ValueProviderContext, CancellationToken). Its default implementation calls the existing context-free resolver for compatibility with custom resources whose runtime connection string differs from their expression.User-facing usage
No extra configuration is required for ordinary parameter references:
While
postgres-passwordis missing,postgresreportsKnownResourceStates.UnresolvedParametersand the dashboard identifies the missing parameter. Supplying the value allows startup to continue.Custom startup callbacks and nested value providers get the same attribution by forwarding a
ValueProviderContextcontaining the execution context and requesting resource toGetValueAsync.Custom connection-string resources can implement the new contextual overload:
Resolvers with custom runtime behavior should retain that behavior and forward the context to any nested value providers. Existing implementations that only provide
GetConnectionStringAsync(CancellationToken)continue to work, but do not gain contextual parameter attribution automatically.Screenshots / Recordings
The branch-built dashboard showing parameter reads made inside an opaque environment callback:
Validation
739 targeted tests passed on the current changes. Quarantined and outerloop tests were excluded.
dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class '*.AddParameterTests' --filter-class '*.AddConnectionStringTests' --filter-class '*.ResourceNotificationTests' --filter-class '*.ApplicationOrchestratorTests' --filter-class '*.ExpressionResolverTests' --filter-class '*.ConditionalReferenceExpressionTests' --filter-class '*.WithReferenceTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class '*.ResourceCommandAnnotationTests' --filter-class '*.WithUrlsTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Hosting.PostgreSQL.Tests\Aspire.Hosting.PostgreSQL.Tests.csproj --no-launch-profile -- --filter-class '*.AddPostgresTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Hosting.Redis.Tests\Aspire.Hosting.Redis.Tests.csproj --no-launch-profile -- --filter-class '*.AddRedisTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Hosting.SqlServer.Tests\Aspire.Hosting.SqlServer.Tests.csproj --no-launch-profile -- --filter-class '*.AddSqlServerTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Hosting.Azure.Tests\Aspire.Hosting.Azure.Tests.csproj --no-launch-profile -- --filter-class '*.AzureKeyVaultTests' --filter-class '*.AzureKeyVaultConnectionPropertiesTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'dotnet test --project tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj --no-launch-profile -- --filter-class '*.ResourceStateViewModelTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'git diff --cached --checkAll 33 affected Hosting projects were also compiled together using a temporary validation solution, which was removed afterward. The build succeeded with an existing
MySqlConnectorvulnerability warning; dashboard validation also reported an existingMicrosoft.Extensions.Validationadvisory.Regression coverage includes the real pre-start connection-string event sequence, missing database passwords, legacy custom resolvers with unused unresolved expressions, contextual redirects, caller attribution, concurrent reads, cancellation/failure, lifecycle-state restoration, and localhost display values.
Earlier manual validation built and started an isolated, no-container AppHost using the branch's Hosting and Dashboard builds. Ordinary environment references and an opaque callback reported their actual pending parameters. Supplying
api-keyreduced the callback's list fromapi-key, regiontoregion; supplyingregionlet both executables finish successfully with exit code 0. The demo was stopped and removed.The full test suite was not run.
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?