microsoft / microsoft/aspire

When Resource is Project and is terminated due to an exception the state is Finished with exit code 0

Open
#7,373 18 comments 7 reactions 0 assignees View on GitHub
area-tooling
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

When using a Project Resource and for any reason it is terminated because of an exception while in debug, in other words, exit code not 0, the dashboard does not keep track of this and marks it as Finished without errors. A consequence is that if another resource is set to `WaitForCompletion` it'll start as if the referenced project was gracefully finished.

App1 is finished with an exception:
![Image](https://github.com/user-attachments/assets/d3a4c03a-4149-490c-b3e0-0a19a159cf41)

App2 is started even if the completion exited with error:
![Image](https://github.com/user-attachments/assets/5ae963ad-54f7-4ac9-bdf5-e091e31ad7e8)

The AppHost is very simple:
```csharp
var app1 = builder.AddProject("app1");

builder.AddProject("app2")
.WithExternalHttpEndpoints()
.WaitForCompletion(app1);
```

### Expected Behavior

The DCP should keep track of the debug exit code instead of marking the resource as Finished without errors.

### Steps To Reproduce

Repro project: https://github.com/arielmoraes/AspireFinishedStateError

I've just created the full Aspire template with two simple console app.

### Exceptions (if any)

_No response_

### .NET Version info

.NET SDK:
Version: 9.0.102
Commit: cb83cd4923
Workload version: 9.0.100-manifests.4a54b1a6
MSBuild version: 17.12.18+ed8c6aec5

Ambiente de runtime:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.102\

Cargas de trabalho do .NET instaladas:
[aspire]
Origem da Instalação: VS 17.12.35707.178
Versão do Manifesto: 8.2.2/8.0.100
Caminho do Manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Tipo de Instalação: Msi

### Anything else?

Using Visual Studio with Aspire 9.0.0 and ASP.NET Core 9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.