microsoft / microsoft/aspire

Unable to debug Aspire Resource project while testing

Open
#5,257 31 comments 3 reactions 1 assignee Assigned to @LittleLittleCloud View on GitHub
area-tooling vs
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 following the [docs to create test projects](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/testing?pivots=xunit) which spin up Aspire services for integration tests, it is not possible to hit a breakpoint and debug the services just like we would when running the Aspire project outside the tests.

Breakpoints on the test code and the AppHost itself are hit just fine. Only the projects orchestrated by the AppHost which are not.

### Expected Behavior

To be able to set breakpoints on the downstream Aspire projects and they would be hit while debugging tests, just as in the normal runtime of Aspire apps.

### Steps To Reproduce

1. Follow the docs and add a test project to an existing Aspire solution: https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/testing?pivots=xunit
2. Put a break point in any place on the downstream projects. It can be on Program.cs or any code that would be otherwise triggered as part of the tests;
3. Debug the test;
4. Observe that the breakpoint is never hit;

I've tested and reproduced on VSCode and Rider. I have no Windows box to test on Visual Studio tho.

### Exceptions (if any)

_No response_

### .NET Version info

```
.NET SDK:
Version: 8.0.302
Commit: ef14e02af8
Workload version: 8.0.300-manifests.e4379c3d
MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment:
OS Name: Mac OS X
OS Version: 14.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.302/

.NET workloads installed:
[aspire]
Installation Source: SDK 8.0.300
Manifest Version: 8.1.0/8.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.1.0/WorkloadManifest.json
Install Type: FileBased

Host:
Version: 8.0.6
Architecture: arm64
Commit: 3b8b000a0e

.NET SDKs installed:
6.0.417 [/usr/local/share/dotnet/sdk]
7.0.404 [/usr/local/share/dotnet/sdk]
8.0.100 [/usr/local/share/dotnet/sdk]
8.0.101 [/usr/local/share/dotnet/sdk]
8.0.201 [/usr/local/share/dotnet/sdk]
8.0.302 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.25 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
```

### Anything else?

Aspire and ASP.Net on its latest versions.

Rider and VSCode also on its latest stable versions.

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.