wk-done
wk-done

Reputation: 967

Debugging Blazor WebAssembly in VSCode (linux) doesn't work

I try to debug a Blazor WebAssembly app in Ubuntu, using VSCode. I'm able to start the application from VSCode but it doesn't hit at any breakpoints.

What I did I followed the guides from Microsoft:

just created a new standard project using

dotnet new blazorwasm -o BlazorWasmApplication1

I'm using the original code from the template.

Properties/launchSettings.json

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:11236",
      "sslPort": 44382
    }
  },
  "profiles": {
    "BlazorWasmLinux": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:7242;http://localhost:5285",
      "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"
      }
    }
  }
}

.vscode/tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/BlazorWasmLinux.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/BlazorWasmLinux.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "--project",
                "${workspaceFolder}/BlazorWasmLinux.csproj"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch and Debug Standalone Blazor WebAssembly App",
            "type": "blazorwasm",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "url": "https://localhost:7242",
            "browser": "chrome"
        }
    ]
}

This is what the debug console shows me.

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Using launch settings from '/home/BooFar/MyProjects/learningblazor/BlazorWasmLinux/Properties/launchSettings.json' [Profile 'BlazorWasmLinux']...
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
... 
... Many entries like the above, loading dlls 
...
      Now listening on: https://localhost:7242
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5285
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/BooFar/MyProjects/learningblazor/BlazorWasmLinux
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Net.Requests.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Net.NetworkInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Net.Sockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Net.NameResolution.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Security.Cryptography.Encoding.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Formats.Asn1.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.Security.Cryptography.OpenSsl.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.1/System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

The application pops up in a separate window. Hovering over the breakpoint shows unbound breakpoint. And of course it doesn't stop there when executing the code. Breakpoint

Has anyone an idea what I'm doing wrong? Or is there any known bug? Or any alternative approaches? Thanks in advance.

MyEnvironment

Upvotes: 1

Views: 1181

Answers (1)

wk-done
wk-done

Reputation: 967

Seems that it was a bug in .NET SDK/runtime? Not really sure See also here.

After updating to .NET Net 6.0.102 the code stopped at the position I was able to step through the code.

Additinally I had to start http not https, but this is a different story (certificate).

So the solution was updating .NET sdk.

Upvotes: 1

Related Questions