Skip to content

Wait ignored when a SqlProject waits for another SqlProject #942

@samgibsonmoj

Description

@samgibsonmoj

Describe the bug

When configuring dependency ordering between SQL projects using .WaitForCompletion(), the call is ignored and both SQL projects run in parallel. This only happens for SQL-to-SQL dependencies, the same call works as expected when a non-SQL project waits for completion of a SQL project.

var builder = DistributedApplication.CreateBuilder(args);

var sql = builder.AddSqlServer("sql");

var exampleDb = sql.AddDatabase("ExampleDb");
var exampleDbTwo = sql.AddDatabase("ExampleDb2");

var exampleDbSqlProj = builder.AddSqlProject<ExampleDb>("Example")
    .WithReference(exampleDb);

builder.AddSqlProject<ExampleDbTwo>("ExampleTwo")
    .WithReference(exampleDbTwo)
    .WaitForCompletion(exampleDbSqlProj); // Ignored

builder.AddProject<ExampleApp>("ExampleApp")
    .WaitForCompletion(exampleDbSqlProj); // Interestingly, not ignored!

Regression

No response

Steps to reproduce

1. Create a new Aspire distributed application.
2. Add a SQL Server resource to the application.
3. Add two SQL database resources (e.g., ExampleDb and ExampleDb2) to the SQL Server instance.
4. Create two SQL project resources in the solution (e.g., Example and ExampleTwo)
5. Configure the second SQL project to wait for the first using .WaitForCompletion().
6. Run the application.

Observe that both SQL projects deploy in parallel, and the .WaitForCompletion() call between the two SQL projects is ignored.

Add another non-SQL project (e.g., a web app) and configure it to .WaitForCompletion() on the first SQL project — note that this behaves correctly and waits.

Expected behavior

I would expect the first SQL Project to wait for the second one, replicating the behaviour of non-SQL projects waiting for SQL projects.

Screenshots

No response

IDE and version

Other

IDE version

VS2026 Insiders [11116.177]

Nuget packages

Aspire.Hosting.AppHost (9.5.2)
Aspire.Hosting.SqlServer (9.5.2)
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects (9.8.1-beta.424)

Additional context

No response

Help us help you

No, just wanted to report this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions