Aspire: WaitForCompletion not working as (I) expected with SQL Projects
Describe the bug
I have 2 SQL projects, where one has references to the other, and the other therefore must be present in order for deployment to complete.
But both projects start “publishing” right away, not waiting for each other
@jmezach FYI
Regression
No response
Steps to reproduce
var builder = DistributedApplication.CreateBuilder(args);
var sqlServer = builder.AddSqlServer("sql");
var wfDatabase = sqlServer.AddDatabase("WF");
var wf2Database = sqlServer.AddDatabase("Default");
var wfSqlProject = builder.AddSqlProject<Projects.Workflow_Database_WF>("wfsqlproj")
.WithReference(wfDatabase);
var wf2SqlProject = builder
.AddSqlProject<Projects.Workflow_Database>("wf2sqlproj")
.WithReference(wf2Database)
.WaitForCompletion(wfSqlProject);
Expected behavior
I was naively expecting WaitForCompletion to work in this scenario.
Screenshots
No response
IDE and version
VS 2022
IDE version
17.12.3
Nuget packages
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects" Version="9.0.0" />
Additional context
No response
Help us help you
Yes, but only if others can assist
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- Wait for dependent resources before depolying the .dacpac fixes #373 — committed to ErikEJ/AspireCommunityToolkit by ErikEJ 2 years ago
- Wait for dependent resources before depolying the .dacpac fixes #373 — committed to ErikEJ/AspireCommunityToolkit by ErikEJ 2 years ago
- Wait for dependent resources before depolying the .dacpac (#380) * Wait for dependent resources before depolying the .dacpac fixes #373 * fix up * move call * Add test to verify wait for dependen... — committed to jianyuyanyu/Aspire by ErikEJ 2 years ago
Ok, I made some changes to lighten what is deployed when and it seems to be working (not hitting race condition) well enough for now. Hopefully it will work more like AddExecutable in the future. Thanks for reviewing.
Hmm, so it looks like we are doing the publish as soon as the target database resource is ready as can be seen here. Perhaps we should add a call to WaitForDependencies there like this.