Search code examples
c#.net.net-8.0dotnet-aspire

Why debugging does not work in subprojects in .NET Aspire deployments?


I was trying to set up a simple .NET Aspire project to test how it works following this tutorial from Microsoft Learn. Aspire workload for Visual Studio will be available in 17.9 onwards, but the current stable Visual Studio release is 17.8, so I decided to go around with the second option, using dotnet CLI.

I created the project and built that. Everything was going well, the dashboard, the projects, the Redis cache, etc.

But when I tried to build the AspireSample.AppHost project with debugging and I attached a breakpoint to somewhere in the Blazor project, I got this error:

Breakpoint error

This problem happened to the Blazor project's Program.cs file too:

Breakpoint error in Program.cs

And, as you might have guessed, the solution provided in the tooltip did not help. This problem is only present in Non-AppHost projects. If I attach a debugger to the AppHost's Program.cs, it will work.

Does anyone know why it is not able to identify the Projects for debugging, and of course, how can I fix it?


Solution

  • You can go to Debug/Attach to Process..., search there by your project name and attach.