Blazor Wasm在program.cs中启动和退出,而没有触发用户代码。

huangapple go评论53阅读模式
英文:

Blazor Wasm starting and exiting without hitting user code in program.cs

问题

我有一个问题,我的Blazor Wasm (.net 6.0) 项目无法在调试模式下运行。它编译完成,打开浏览器并指向带有正确端口的localhost,但然后在没有错误消息的情况下失败。浏览器窗口消失,就好像程序正常退出了。

昨晚它还能正常工作,但似乎在过夜后停止了。有什么关于如何调试的想法吗?

英文:

I have a problem where my Blazor Wasm (.net 6.0) project won't run in debug mode. It compiles, opens a browser and points to localhost with the correct port but then fails with no error message. The browser window disappears as if the program exited normally.

It was working absolutely fine last night and just seems to have stopped overnight. Any ideas on how to debug?

答案1

得分: 1

无法在尝试调试时获得乐趣 - 一个新的 Blazor WebAssembly 项目运行正常,但一旦我开始添加脚本来加载 Bootstrap,它就再次失败。

对我有效的方法是退出 Visual Studio,删除项目根目录中的 .vs 文件夹,然后再次打开 Visual Studio。

英文:

No joy in trying to debug this - a new blazor wasm project runs fine, but as soon as I start adding scripts to load bootstrap it fails again.

What worked for me was to exit VS, delete the .vs folder in the project root and then open VS again.

答案2

得分: 0

Ok, while deleting the .vs folder does work it has become extremely tedious when this issue keeps on occurring every 5 minutes.

问题似乎与运行应用程序时代码中存在的断点相关。我发现如果你从代码中删除所有断点(CTRL-SHIFT-F9),应用程序将可以正常运行而不会崩溃。

该问题已在此处报告:https://github.com/dotnet/aspnetcore/issues/47238

英文:

Ok, while deleting the .vs folder does work it has become extremely tedious when this issue keeps on occurring every 5 minutes.

The problem seems to related to breakpoints that exist in the code when you run the app. I have found that if you delete all breakpoints from your code (CTRL-SHIFT-F9) the app runs without crashing.

The issue has been reported here https://github.com/dotnet/aspnetcore/issues/47238

答案3

得分: 0

Blazor debugging seems to be broken by a chromium update. Reddit post with link to Microsoft

One person replied it could be fixed by downgrading Edge.

Also adding breakpoints while debugging seems to trigger this bug.

英文:

Blazor debugging seems to be broken by a chromium update. Reddit post with link to Microsoft

One person replied it could be fixed by downgrading Edge.

Also adding breakpoints while debugging seems to trigger this bug.

答案4

得分: 0

我刚刚升级到 Edge 111.0.1661.43,现在可以在我的项目中使用已设置的断点运行。

英文:

I have just upgraded to Edge 111.0.1661.43 and can now run with breakpoints already set in my project.

huangapple
  • 本文由 发表于 2023年3月15日 18:00:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743125.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定