简体   繁体   English

Blazor WebAssembly 断点不起作用

[英]Blazor WebAssembly Breakpoints not working

I'm trying to debug a Blazor web assembly app with breakpoints.我正在尝试使用断点调试 Blazor web 程序集应用程序。

If I add a breakpoint within Visual Studio I get this message on my breakpoint.如果我在 Visual Studio 中添加断点,我会在断点处收到此消息。

The breakpoint will not currently be hit no symbols where loaded for this document.断点当前不会在为该文档加载的任何符号处命中。

I updated visual studio.我更新了视觉工作室。

I made sure the inspectUri was added to both the client and server setting.json.我确保将inspectUri 添加到客户端和服务器设置中。json。

I unchecked enable diagnostic tool while debugging in settings.我在设置中调试时取消选中启用诊断工具。

I tried to run as administrator.我试图以管理员身份运行。 I also tried the answer here: How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document."我也在这里尝试了答案: 我该如何补救“断点当前不会被命中。没有为此文档加载任何符号。” warning? 警告?

Any help will be appreciated任何帮助将不胜感激

Regards,问候,

At the begining you should know WASM debuging works on Chromium browsers like Edge and Chrome.一开始您应该知道 WASM 调试适用于 Edge 和 Chrome 等 Chromium 浏览器。 Then make this changes.然后进行此更改。

Open launchSetting.json file, in IIS Express profile and add this code after "launchBrowser": true, :IIS Express配置文件中打开launchSetting.json文件,并在"launchBrowser": true,

"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",

Repeat it for other profiles, for example TestBlazor.WASM .对其他配置文件重复此操作,例如TestBlazor.WASM

This peace of code:这种和平的代码:

  • Enables the IDE to detect that the app is a Blazor WebAssembly app.启用 IDE 以检测应用程序是 Blazor WebAssembly 应用程序。
  • Instructs the script debugging infrastructure to connect to the browser through Blazor's debugging proxy.指示脚本调试基础结构通过 Blazor 的调试代理连接到浏览器。

Those changes works well but in some cases that failed, add this "nativeDebugging": true to all profiles.这些更改效果很好,但在某些情况下失败了,请将此"nativeDebugging": true添加到所有配置文件。

If your App hosts on another base app than / , change the properties like this:如果您的应用托管在/以外的其他基础应用上,请更改以下属性:

"iisExpress": {
    "applicationUrl": "http://localhost:{INSECURE PORT}/{APP BASE PATH}/",
    "sslPort": {SECURE PORT}
}

And for each profiles:对于每个配置文件:

"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/{APP BASE PATH}/_framework/debug/ws-proxy?browser={browserInspectUri}",

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

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