aspire: Unable to debug Aspire Resource project while testing
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When following the docs to create test projects 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
- 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
- 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;
- Debug the test;
- 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.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 15 (9 by maintainers)
@timheuer sorry, I meant “Debug the tests” on step 3. (edited)
@DoubleTK I tried the EAP yesterday which has the Aspire plugin embedded and not as a “3rd party” extension. Still same problem for me.
It appears that somehow the debug session is not attaching the debugger to the orchestrated projects. The breakpoint “red circle” on the left of the line appears empty, as if it were disabled or like if no symbols were available.
I am seeing this in Visual Studio 2022 on Windows with Aspire 9.3. Breakpoints in integration test code and the app host are hit, but breakpoints in other projects are not hit (the breakpoint dot in the source window says “The breakpoint will not currently be hit”).
I have disabled “Just My Code” and set “Require source files to exactly match the original version” to false. I don’t see any errors in the debug console.
I haven’t dug too much into using vscode and the C# DevKit, but I had the same issue with both, on the same OS. Debugging unit tests in rider is a known issue, with a PR already merged into the EAP release of Rider. Here’s the link to the issue: https://github.com/JetBrains/aspire-plugin/issues/185
Technically the PR is for the Aspire Plugin, but the version it was included in is not available in the latest stable release of Rider.
Once I switched to the EAP release, debugging of unit tests started working.
For vscode, not sure. I’d be interested in hearing what you find, if anything.