[Failing test]: Aspire.Hosting.Containers.Tests.WithDockerfileTests.AddDockerfileLaunchesContainerSuccessfully
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Build information
Build: https://github.com/microsoft/aspire/actions/runs/28398379483
Build error leg or test failing: Aspire.Hosting.Containers.Tests.WithDockerfileTests.AddDockerfileLaunchesContainerSuccessfully
Logs: [Tests / Hosting.Containers / Hosting.Containers \(ubuntu-latest\)](https://github.com/microsoft/aspire/actions/runs/28398379483/job/84143478670)
### Fill in the error message template
## Error Message
Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssueJsonStepByStep.md).
```json
{
"ErrorMessage": "System.IO.InvalidDataException : Service testcontainer should have valid address at this point",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```
### Error details
Error details (46 lines)
```yml
Error Message: System.IO.InvalidDataException : Service testcontainer should have valid address at this point
|
|
|
|
|
|
|
|
|
Stack Trace:
at Aspire.Hosting.Dcp.DcpModelUtilities.TryAddLocalhostAllocatedEndpoint(ServiceWithModelResource sp, Boolean allowPending, Nullable`1 fallbackPort) in /_/src/Aspire.Hosting/Dcp/DcpModelUtilities.cs:line 172
at Aspire.Hosting.Dcp.DcpModelUtilities.TryAddWorkloadAllocatedEndpoints[TDcpResource](RenderedModelResource`1 resource, Boolean enableAspireContainerTunnel, String containerHostName) in /_/src/Aspire.Hosting/Dcp/DcpModelUtilities.cs:line 120
at Aspire.Hosting.Dcp.DcpExecutor.<>c__DisplayClass36_1.<b__3>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 225
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.DcpExecutor.<>c__DisplayClass36_1.<b__5>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 257
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.DcpExecutor.RunApplicationAsync(CancellationToken ct) in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 263
at Aspire.Hosting.Orchestrator.ApplicationOrchestrator.RunApplicationAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:line 563
at Aspire.Hosting.Orchestrator.OrchestratorHostService.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Orchestrator/OrchestratorHostService.cs:line 41
at Microsoft.Extensions.Hosting.Internal.Host.b__14_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.g__LogAndRethrow|14_3(<>c__DisplayClass14_0&)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Aspire.Hosting.DistributedApplication.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 472
at Aspire.Hosting.Containers.Tests.WithDockerfileTests.AddDockerfileLaunchesContainerSuccessfully() in /home/runner/work/aspire/aspire/tests/Aspire.Hosting.Containers.Tests/WithDockerfileTests.cs:line 240
--- End of stack trace from previous location ---
### StdOut
| [2026-06-29T19:52:55] Aspire.Hosting.DistributedApplication Information: Aspire AppHost version: 13.5.0-pr.18561.g8950658b
| [2026-06-29T19:52:55] Aspire.Hosting.DistributedApplication Information: Distributed application starting.
| [2026-06-29T19:52:55] Aspire.Hosting.DistributedApplication Information: Application host directory is: /home/runner/work/aspire/aspire/tests/Aspire.Hosting.TestUtilities
| [2026-06-29T19:52:58] Aspire.Hosting.Dcp.DcpHost Information: Starting DCP with arguments: start-apiserver --monitor 4930 --detach --kubeconfig "/tmp/aspire-dcpnIntwr/kubeconfig" --tls-cert-thumbprint "8731F22C678539F354097F08FA6828D18B4CCF7A" --tls-cert-file "/home/runner/.aspire/dev-certs/https/F93620E59D489C595D71567ABC32DBC0A0E895D3507BB54918D6EDD5B78C00B2.crt" --tls-key-file "/home/runner/.aspire/dev-certs/https/F93620E59D489C595D71567ABC32DBC0A0E895D3507BB54918D6EDD5B78C00B2.key"
| [2026-06-29T19:55:00] Aspire.Hosting.DistributedApplication Warning: Unable to allocate a network port for service 'testcontainer'; service may be unreachable and its clients may not work properly.
| [2026-06-29T19:55:00] Microsoft.Extensions.Hosting.Internal.Host Error: Hosting failed to start
| System.IO.InvalidDataException: Service testcontainer should have valid address at this point
at Aspire.Hosting.Dcp.DcpModelUtilities.TryAddLocalhostAllocatedEndpoint(ServiceWithModelResource sp, Boolean allowPending, Nullable`1 fallbackPort) in /_/src/Aspire.Hosting/Dcp/DcpModelUtilities.cs:line 172
at Aspire.Hosting.Dcp.DcpModelUtilities.TryAddWorkloadAllocatedEndpoints[TDcpResource](RenderedModelResource`1 resource, Boolean enableAspireContainerTunnel, String containerHostName) in /_/src/Aspire.Hosting/Dcp/DcpModelUtilities.cs:line 120
at Aspire.Hosting.Dcp.DcpExecutor.<>c__DisplayClass36_1.<b__3>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 225
| --- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.DcpExecutor.<>c__DisplayClass36_1.<b__5>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 257
| --- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.DcpExecutor.RunApplicationAsync(CancellationToken ct) in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 263
at Aspire.Hosting.Orchestrator.ApplicationOrchestrator.RunApplicationAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:line 563
at Aspire.Hosting.Orchestrator.OrchestratorHostService.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Orchestrator/OrchestratorHostService.cs:line 41
at Microsoft.Extensions.Hosting.Internal.Host.b__14_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
```
Standard Output
_No content captured._
📊 **[View CI Failure Report](https://github.com/microsoft/aspire/issues/18563#issuecomment-4836988139)**
Contributor guide
Research direction
Start with tests/Aspire.Hosting.Containers.Tests/WithDockerfileTests.cs at AddDockerfileLaunchesContainerSuccessfully and reproduce the failure. Then read src/Aspire.Hosting/Dcp/DcpModelUtilities.cs around TryAddLocalhostAllocatedEndpoint and the related DcpExecutor calls in the stack trace. Done means the Dockerfile container test starts successfully with a valid service address.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, docker, dockerfile
- Domain
- devops, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100