ResourceNotificationService.WaitForResourceAsync is unreliable for Postgres resource #5469
Closed
1 task done
Labels
area-app-model
Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone
Is there an existing issue for this?
Describe the bug
Calling
await ResourceNotificationService.WaitForResourceAsync("postgres-db", KnownResourceStates.Running)
returns too early and results in cryptic exceptions when trying to actually connect to the database.Expected Behavior
The database should be fully accessible when this method has returned.
Steps To Reproduce
This occurs when I am writing an integration test and need to do a database migration. Consider the following code:
AppHost/Program.cs
MyTests.cs
The
MyDbContext
is a EF CoreDbContext
.An exception pops up when calling
ctx.Database.MigrateAsync()
(see below).Key points are:
Task.Delay(1000)
before creating the context or wait on a breakpointExceptions (if any)
.NET Version info
Anything else?
Output for
dotnet workload list
:The packages in the solution are v8.1.0.
The text was updated successfully, but these errors were encountered: