ConnectionStringParameterResource does not publish ConnectionStringAvailableEvent
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
Consider the following code
```csharp
using System.Diagnostics;
var builder = DistributedApplication.CreateBuilder(args);
var foo = builder.AddConnectionString("Foo")
.OnConnectionStringAvailable(async (_, _, _) =>
{
Console.WriteLine("Connection string is available.");
Debugger.Break();
});
var app = builder.Build();
//await builder.Eventing.PublishAsync(new ConnectionStringAvailableEvent(foo.Resource, app.Services));
app.Run();
```
I would expect the event to be automatically published on application start, but the `Break()` is only hit when the second to last line is uncommented and the event is manually published.
### Expected Behavior
The event should be published on application start, or when a value has been entered in the Dashboard if it was missing in the beginning.
### Steps To Reproduce
Create a new Aspire AppHost Project and paste the above code.
I could reproduce it on `13.0.0` and `9.5.0`.
I have not tried earlier versions.
### Exceptions (if any)
_No response_
### .NET Version info
.NET SDK:
Version: 10.0.100
Commit: b0f34d51fc
Workload version: 10.0.100.1
MSBuild version: 18.0.2+b0f34d51f
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100\
Installierte .NET-Workloads:
Es sind keine installierten Workloads zum Anzeigen vorhanden.
Für die Verwendung von workload sets bei der Installation neuer Manifeste konfiguriert.
Host:
Version: 10.0.0
Architecture: x64
Commit: b0f34d51fc
.NET SDKs installed:
8.0.416 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]
10.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
### Anything else?
.NET Aspire version 13.0.0
Contributor guide
Research direction
Start with the AppHost entry point using AddConnectionString and OnConnectionStringAvailable, then trace the ConnectionStringAvailableEvent publishing path during Build and app startup. Compare that path with the explicit Eventing.PublishAsync call and the Dashboard value-entry case. Done means the callback runs automatically on startup or after a missing value is entered, without manual publishing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100