Blazor客户端调试 [英] Blazor client-side debugging

查看:903
本文介绍了Blazor客户端调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的所有C#断点都没有被击中,因为客户端Blazor应用的调试似乎已被禁用.

I noticed that all of my C# breakpoints do not get hit as debugging seems like its disabled for client-side Blazor apps.

是否可以通过某种方式连接调试器或启用调试器?

Is there a way to attach the debugger or enable the debugger somehow?

谢谢

推荐答案

对于那些喜欢一些图片的人,这里是逐步使用Visual Studio 16.4预览版(.NET Core 3.1预览版2)& Chrome版本78.

For those who like some pictures, here's a step by step using Visual Studio 16.4 preview (.NET Core 3.1 preview 2) & Chrome version 78.

使用调试配置文件启动应用.例如

网站加载后,然后将光标放在Chrome标签上,按"Shift + Alt + D".

After site loads, and with the cursor focus on the chrome tab press "Shift+Alt+D".

Chrome浏览器将打开一个新标签,显示无法找到可调试的浏览器标签".找到消息的第一个实例"Press Win + R".复制下面的完整行,该行以"chrome-remote-debugging-port ..."开头.

Chrome will open a new tab showing "Unable to find debuggable browser tab". Find the first instance of the message "Press Win+R". Copy the full line below which starts "chrome -- remote-debugging-port..."

点击"Win + R" ,然后粘贴您刚刚复制的文本,然后按Enter键.一个新的Chrome窗口将打开..

Hit "Win+R" and paste in the text you just copied and hit enter. A new Chrome window will open..

第二次,按"Shift + Alt + D"现在您应该会看到一些更有前途的东西.

For the second time, press "Shift+Alt+D" and you should now see something a bit more promising..

从此处设置一些断点,例如

返回到运行Blazor应用程序的标签页,触发您的断点. 在这里,您可以按F10一步,按F8继续.通过范围"检查当地人.窗口.

Go back to the tab running Blazor app, trigger your breakpoint. From here you can press F10 for a single step, and F8 for resume. Inspect locals via the "Scope" window as shown.

这篇关于Blazor客户端调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆