[WebToolsE2E][Aspire] The webfrontend of the Aspire project with Azure Service Bus integration remains in the 'Running (Unhealthy)' state and has some errors in the console logs.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
**REGRESSION INFO**
1. Worked in Aspire 9.1.0
**INSTALL STEPS**
1. Clean machine: Win11 x64 24h2 ENU
2. Install VS 17.13.6
3. Add dotnet9 feed for 9.2.0
4. Install the latest Aspire 9.2.0
`- dotnet new install Aspire.ProjectTemplates::9.2.0 --force`
5. Install Docker/Podman Desktop
**REPRO STEPS**
1. New Project > Aspire Starter App > check 'Use Redis for caching (requires Docker)' > .NET 9.0 (Standard-Term Support) > Aspire version 9.2 > Create
2. Right-click xxx.web project > Add > .NET Aspire package > Aspire.Azure.Messaging.ServiceBus > add a component and try to use it in the code
3. In the Program.cs of web project, type following codes:
`builder.AddAzureServiceBusClient("sb");`
4.Open appsettings.json of xxx.web project, add this code:
```
{
"Aspire": {
"Azure": {
"Messaging": {
"ServiceBus": {
"HealthCheckQueueName": "myQueue",
"DisableTracing": false,
"ClientOptions": {
"Identifier": "CLIENT_ID"
}
}
}
}
}
}
```
5. In your AppHost project, install the "Aspire.Hosting.Azure.ServiceBus"
6. Open appsettings.json of xxx.AppHost project, add ConnectionStrings configuration section:
```
{
"ConnectionStrings": {
"serviceBusConnectionName": "{your_namespace}.servicebus.windows.net"
}
}
```
7. Open Program.cs of xxx.AppHost project, add following codes:
```
var serviceBus = builder.ExecutionContext.IsPublishMode
? builder.AddAzureServiceBus("sb")
: builder.AddConnectionString("sb");
var myService = builder.AddProject()
.WithReference(serviceBus);
```
8. Build and F5
**ACTUAL**
The webfrontend remains in the 'Running(Unhealty)' state and has some errors in the Console logs:
```
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.ArgumentNullException: Value cannot be null. (Parameter 'options.Credential')
at System.ArgumentNullException.Throw(String paramName)
at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
at Guard.ThrowIfNull[T](T argument, Boolean throwOnEmptyString, String paramName) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/CallerArgumentExpressionAttribute.cs:line 47
at HealthChecks.AzureServiceBus.AzureServiceBusHealthCheck`1..ctor(TOptions options, ServiceBusClientProvider clientProvider) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.AzureServiceBus/AzureServiceBusHealthCheck.cs:line 28
at HealthChecks.AzureServiceBus.AzureServiceBusQueueHealthCheck..ctor(AzureServiceBusQueueHealthCheckOptions options, ServiceBusClientProvider clientProvider) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.AzureServiceBus/AzureServiceBusQueueHealthCheck.cs:line 11
at HealthChecks.AzureServiceBus.AzureServiceBusQueueHealthCheck..ctor(AzureServiceBusQueueHealthCheckOptions options) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.AzureServiceBus/AzureServiceBusQueueHealthCheck.cs:line 19
at Microsoft.Extensions.Hosting.AspireServiceBusExtensions.MessageBusComponent.CreateHealthCheck(ServiceBusClient client, AzureMessagingServiceBusSettings settings) in /_/src/Components/Aspire.Azure.Messaging.ServiceBus/AspireServiceBusExtensions.cs:line 88
at Aspire.Azure.Common.AzureComponent`3.<>c__DisplayClass12_0.b__5(IServiceProvider serviceProvider) in /_/src/Components/Common/AzureComponent.cs:line 127
at Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService.RunCheckAsync(HealthCheckRegistration registration, CancellationToken cancellationToken)
at Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService.RunCheckAsync(HealthCheckRegistration registration, CancellationToken cancellationToken)
at Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService.CheckHealthAsync(Func`2 predicate, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckMiddleware.InvokeAsync(HttpContext httpContext)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
```


**RESULT**
The webfrontend should run successfully without errrors in Console logs.
Contributor guide
Assessment
This issue has not been assessed yet.