Improve logging of `ResourceReadyEvent` failures
- 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
### Is your feature request related to a problem? Please describe the problem.
Take the following app host with a `ResourceReadyEvent` subscription that throws an error
```cs
var builder = DistributedApplication.CreateBuilder(args);
var apiService = builder.AddProject("apiservice");
var web = builder.AddProject("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(apiService)
.WaitFor(apiService);
web.WithHttpHealthCheck();
builder.Eventing.Subscribe(apiService.Resource, async (evt, ct) => {
throw new Exception("FAILURE");
});
builder.Build().Run();
```
I'd expect to see something about the failure of the `ResourceReadyEvent` in the resource logs, but there isn't

An exception does get reported against any dependencies waiting on the original resource, although if multiple failures happen, only one of the errors will ever get reported.

In the below scenario, the Web resource will report either `failure 1` or `failure 2`, but never both.
```cs
var builder = DistributedApplication.CreateBuilder(args);
var apiService1 = builder.AddProject("apiservice");
var apiService2 = builder.AddProject("apiservice2");
var web = builder.AddProject("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(apiService1)
.WaitFor(apiService1)
.WaitFor(apiService2);
web.WithHttpHealthCheck();
builder.Eventing.Subscribe(apiService1.Resource, async (evt, ct) => {
throw new Exception("failure 1");
});
builder.Eventing.Subscribe(apiService2.Resource, async (evt, ct) => {
throw new Exception("failure 2");
});
builder.Build().Run();
```
### Describe the solution you'd like
I'd expect to see the exception from `ResourceReadyEvent` logged to `ResourceLoggerService.GetLogger(resorurce)`
### Additional context
Versions:
```xml
```
Contributor guide
Assessment
This issue has not been assessed yet.