简体   繁体   English

在 VSCode (linux) 中调试 Blazor WebAssembly 不起作用

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

I try to debug a Blazor WebAssembly app in Ubuntu, using VSCode.我尝试使用 VSCode 在 Ubuntu 中调试 Blazor WebAssembly 应用程序。 I'm able to start the application from VSCode but it doesn't hit at any breakpoints .我可以从 VSCode 启动应用程序,但它不会在任何断点处命中

What I did I followed the guides from Microsoft:我做了什么,我遵循了 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属性/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 .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 .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 .应用单独弹出 window 悬停在断点上显示unbound breakpoint And of course it doesn't stop there when executing the code.当然,执行代码时它不会就此停止。 断点

Has anyone an idea what I'm doing wrong?有谁知道我做错了什么? Or is there any known bug?或者有什么已知的错误吗? Or any alternative approaches?或者任何替代方法? Thanks in advance.提前致谢。

MyEnvironment我的环境

Seems that it was a bug in .NET SDK/runtime?似乎这是 .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.更新到 .NET Net 6.0.102 后,代码停在 position,我能够单步执行代码。

Additinally I had to start http not https, but this is a different story (certificate).另外我不得不开始 http 而不是 https,但这是一个不同的故事(证书)。

So the solution was updating .NET sdk.所以解决方案是更新 .NET sdk。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM