Visual Studio javascript 调试不起作用 [英] Visual Studio javascript debugging not working

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

问题描述

本博客:从 Visual Studio 在 Microsoft Edge 中调试 JavaScript

解决方案

Visual Studio javascript 调试不起作用

恐怕你在cshtml文件中得不到你想要的.正如

This blog: Debug JavaScript in Microsoft Edge from Visual Studio https://devblogs.microsoft.com/visualstudio/debug-javascript-in-microsoft-edge-from-visual-studio/ describes how VS is supposed to debug javascript.

It looks great. However, I cannot get it to work. I have a .Net Core 3.1 Razor project.

In IE, Edge, Edge Beta, and Chrome I cannot get the script debugger to work. I have uninstalled all my Visual Studio versions. I have re-installed VS 2019 Community, 16.5.4

My breakpoints always look like this:

解决方案

Visual Studio javascript debugging not working

I am afraid that you cannot get what you want in cshtml file. As this similar issue said, you cannot debug js code in cshtml file and only for code in separate xxx.js (or xxx.ts) files.

Solution

Instead, you should create a new js file and then migrate these js code into this file and then it should work.

And when you debug your project and load this cshtml page, the breakpoint will not appear and when you finish loading the page, then the breakpoint will appear. And this is the cshtml feature.

Update 1

1) When I try to create a new asp.net core project and then add js code in Viewstart.cshtml file, it will not be hit during debugging.

To prove it, l create a new single js file and migrate the js code into it.

After that, reference this js single in cshtml file and then it will be hit during debugging.

这篇关于Visual Studio javascript 调试不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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