aspnetcore: Blazor WebAssembly doesn't load symbols for debugging

Describe the bug

A newly created blazorwasm project inside of an empty folder with automatically created launch.json (I’ve added the option to launch edge in there) and tasks.json cannot be debugged on Ubuntu 20.04 because the symbols do not get loaded. I keep getting the “Additional setup is required to debug Blazor WebAssembly applications.” notification but I have no idea what I’m doing wrong.

To Reproduce

  1. Create a new folder called MyBlazorApp somewhere
  2. Navigate inside the folder and Open in Terminal
  3. Type dotnet new blazorwasm
  4. Type code .; exit
  5. Allow VS Code to auto-generate launch.json and tasks.json
  6. Inside launch.json, add "browser": "edge" to the first configuration in the list
  7. Go to the file Counter.razor inside of the Pages folder and put a breakpoint where it says currentCount++;
  8. Press F5 to debug
  9. Ctrl + click on one of the local addresses to debug the Blazor app
  10. Go to the counter page and press the button
  11. Nothing happens

Exceptions (if any)

I have tried the above steps a couple times in different folders, but it never debugs properly.

Further technical details

  • ASP.NET Core version: 6.0.0
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version: VS Code 1.62.2
  • Operating System: Ubuntu 20.04
  • C# for Visual Studio Code version: v1.23.16
  • Browser: Microsoft Edge (dev) 96.0.1043.1-1 (edge_stable-stable-main)
  • Include the output of dotnet --info:
dotnet --info Output
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  5.0.402 [/usr/share/dotnet/sdk]
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
launch.json Contents
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch and Debug Standalone Blazor WebAssembly App",
            "type": "blazorwasm",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "browser": "edge"
        }
    ]
}
tasks.json Contents
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/MyBlazorApp.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/MyBlazorApp.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "${workspaceFolder}/MyBlazorApp.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}
launchSettings.json Contents
{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:55666",
      "sslPort": 44381
    }
  },
  "profiles": {
    "MyBlazorApp": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:7072;http://localhost:5032",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 54 (22 by maintainers)

Most upvoted comments

I managed to get it working on my setup yesterday.

I had .net6 installed along with visual studio community 2022, removed visual studio 2022 and installed the full net 6 sdk from microsoft download site and debug started working in VS Code.

I dont understand why because a .net5 project was hitting debug symbols fine and it was installed also along with vs 2022.

Hope this helps someone

PS. Althought it already works c# extension keeps showing the popup notification telling something is missing to debug blazor webassembly

Are there any indications as to what the issue could be? I’ve recently tried this again with the chrome option, and while the debugging session actually launched a new browser window, the page was blank (didn’t redirect to any of the open localhost addresses) and closed automatically shortly after.

@TanayParikh hi, I’ve updated my question to include the contents of launchSettings.json

I created a new issue about it on their repo: https://github.com/microsoft/vscode-js-debug/issues/1190

Thank you everybody! 😃

@mkArtakMSFT , I think we should move this issue to vscode-js-debug, or to create another one for them. What do you think?

@thaystg debugging with chrome works! The only downside is that I get a pop-up with the following warning when I debug a second time (after closing the previous debug sessions):

It looks like a browser is already running from an old debug session. Please close it before trying to debug, otherwise VS Code may not be able to connect to it.

But there’s no chrome window open. Logging out and logging in again does not fix this, a full reboot does fix it.

I installed chrome again just to test, but debugging launches a blank page and doesn’t try to open the localhost addresses. Moreover, the page closes automatically after a few minutes.

@mkArtakMSFT for some reason the BrowserDebugHost is not being started that is why the breakpoints are not being bind. This is not on our side, do you know who can work on this?

@thaystg can you please look into this? Looks like there are multiple issues discussed and the one to look at is what the title says.

I have the same issue on windows 10. vscode can debug server side but not the wasm client. vs 2022 works fine. same code base works fine on mac’s vscode. Already uninstalled all the sdks and repair vs2022. still can’t hit the breakpoint on wasm.

@TanayParikh by default browser and Uri are note specified in launch.json , I have added those now. I also did: dotnet dev-certs https --trust so “dotnet run debug” also works.

so I confirm this now works, and can be closed.

Hi, I do not have any Visual studio installed, only latest VS Code and only .NET 6 SDK, and still not working. Can you please provide your simple new project with dotnet new blazorwasm and configuration files (launch.json etc.) for debugging in Microsoft Edge using VS Code ?