aspire: Debugging a Blazor WASM doesn't hit breakpoints in IDE

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

For reference, I did do a search on blazor wasm on all issues and found these related ones

  1. #1793 But this one seems to be about debugging in the browser, whereas I’m looking for debugging in my IDE.
  2. #1418 Seems to be about exactly what I’d like to do but is closed and I can’t provide any input there.

The issue at hand is as follows

  1. Having a project Microsoft.NET.Sdk.BlazorWebAssembly;
  2. Put a breakpoint at some code;
  3. When debugging the project directly, a debugger attaches just fine, and breakpoints are hit;
  4. When debugging via .NET Aspire, seemingly no debugger attaches and breakpoints are not hit.

Expected Behavior

Start a debug session on a .NET Aspire project and being able to debug Blazor WASM projects, just like any other regular .NET project can be debugged.

Steps To Reproduce

  1. dotnet new aspire
  2. dotnet new blazorwasm -o Web
  3. dotnet sln add Web
  4. dotnet add AppHost.AppHost reference Web
  5. Add _ = builder.AddProject<Projects.Web>("web"); to AppHost.AppHost/Program.cs
  6. Add a breakpoint at Web/Pages/Counter.razor in the IncrementCount method

When starting a debug session directly on the Web project, a browser tab will open up. It will initially say that a debugger is being attached and after that, it will actually load. Going to the Counter page and clicking the button will hit the breakpoint. image image image

When starting a debug session on the AppHost.AppHost project, a browser tab will open up. It shows the dashboard and navigating to the Web project doesn’t show the debugger being attached message and goes straight into the regular loading. Going to the Counter page and clicking the button will not hit the breakpoint. image image

The very deceiving part is that it does say the debugger is being attached, but in reality, it’s not. Here’s a screenshot of the scenario with Visual Studio instead. As you can see, then there’s no message at all of a debugger being attached. This is also the case for debugging Web directly by the way (but then the breakpoints do get hit). image

Exceptions (if any)

No response

.NET Version info

dotnet --info

.NET SDK:
 Version:           8.0.205
 Commit:            3e1383b780
 Workload version:  8.0.200-manifests.f51a3a6b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.205\

.NET workloads installed:
 [aspire]
   Installation Source: SDK 8.0.200
   Manifest Version:    8.2.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json
   Install Type:              Msi


Host:
  Version:      8.0.8
  Architecture: x64
  Commit:       08338fcaa5

.NET SDKs installed:
  8.0.108 [C:\Program Files\dotnet\sdk]
  8.0.200 [C:\Program Files\dotnet\sdk]
  8.0.205 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

I’ve tried this with Visual Studio 17.9.7 and Rider 2024.2.5 and they show exactly the same behavior. I am running on Windows 23H2 = 22631.4169.

dotnet workload list

Installed Workload Id      Manifest Version      Installation Source
--------------------------------------------------------------------
aspire                     8.2.0/8.0.100         SDK 8.0.200

Please note that the following packages were used

<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.0" />

<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 9
  • Comments: 27 (8 by maintainers)

Most upvoted comments

I’ve fixed my issue. To other people experiencing this problem: Make sure the launch profile name (e.g. “https”) is the same in both the AppHost project and the blazor project or manually provide the launch profile name when adding the blazor project in the AppHost program.cs. I had changed the launch settings name in my blazor application, which resulted in the second browser for the blazor app to not spawn.

Same issue 17.12.2, aspire 9.

Same issue in VS 17.12.1 using Aspire 9.0.0

My project was created with the Aspire Starter Template, but I swapped out the Blazor Server project for a Standalone WASM project.

It runs - but any breakpoint in my WASM project gives me the “Won’t hit, no symbols loaded” breakpoint issue.

@isaacrlevin yah this issue hasn’t been triaged yet. We have a large backlog of untriaged issues we’re working through. The previous issue tracking this support was #1418 and according to the comments it was successfully enabled around preview 5 of Aspire 9. It’s possible it regressed of course.

FYI @vijayrkn

@davidfowl @DamianEdwards @maddymontaquila I see this is marked as a bug but nothing else. Doesn’t work with latest .NET and Aspire 9 and newest VS 2022 Enterprise preview.