Repository navigation
fix(aspire): build a head only once its dependencies are ready - #3320
Open
Kunal22shah wants to merge 2 commits into
Open
Kunal22shah wants to merge 2 commits into
Kunal22shah wants to merge 2 commits into
Conversation
Kunal22shah
marked this pull request as ready for review
November 28, 2026 17:12
|
Tick the box to add this pull request to the merge queue (same as
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #3309. Follows #3310, independent of the open Aspire PRs.
PR Type
What is the current behavior?
On a first build, an app from
dotnet new unoapp -preset recommended -server -aspirecan fail to start: the AppHost builds the app's head at the same moment Aspire builds the server, both build the shared*.DataContractsproject, and one fails withCS2012("Cannot open ... DataContracts.dll for writing"). Depending on which build loses, the API or the head ends up FailedToStart. Warm builds usually escape it.The head's build runs in
OnBeforeResourceStarted, which Aspire raises before it processes the head'sWaitFordependencies.What is the new behavior?
Before building, the head waits for the resources it waits for (
WaitFor,WaitForStart) to be ready, through Aspire'sResourceNotificationService.WaitForDependenciesAsync. It shows Waiting meanwhile, as any Aspire resource does. Aspire's own build of the server is finished by then, so the shared project is built once at a time.A head that shares a project with a resource it does not wait for can still collide; the template waits for the API on every head.
Reviewer's guide
UnoProjectBuilderExtensions.cs.Given_HeadBuild.When_HeadWaitsForAResource_Then_ItBuildsOnlyOnceThatResourceRunsfails without the fix (the head never reaches Waiting) and passes with it.Verification
Uno.Extensions.Aspire.Hosting.Tests: 32 passed.binorobjfolder: the first run failed withCS2012onFlow.DataContracts.dlland the API never started; with the fix, the API and every head started and the heads reached the API.PR Checklist
🤖 Generated with Claude Code