为什么无法在 ASP.NET 视图中设置断点?

发布于 2024-10-10 07:12:58 字数 173 浏览 1 评论 0原文

如果我在编译的代码中设置断点(例如在操作中),我就可以单步执行,并最终单步执行视图的生成。

我曾多次发现这很有用,但它很乏味,因为您必须逐步执行大量代码才能到达那里。

但是,我无法在视图中设置断点。我刚刚收到来自 VS2008 的消息'这不是断点的有效位置'。这是为什么呢?

If I set a breakpoint in the compiled code (for instance in an action), I can then step through, and eventually am stepping through the generation of the View.

I've found this useful a couple of times, but it's tedious as you have to step through a lot of code to get there.

However, I can't set a breakpoint in view. I just receive the message 'This is not a valid location for a breakpoint' from VS2008. Why is this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

忆离笙 2024-10-17 07:12:58

右键单击要中断的代码,然后转到“断点 -> 插入断点”。

为什么?一定与您不使用纯代码文件并且点击左侧边栏不知道要使用哪个代码块的情况有关。

Right click on the code you want to break on and go to "Breakpoint -> Insert Breakpoint".

Why? Must have something to do with the face your not working with a pure code file and hitting the left sidebar doesn't know which block of code to use.

伴梦长久 2024-10-17 07:12:58

我想到的另一件事是使用调试器;视图中的关键字,尽管我不能 100% 确定它会像在 ASP.NET ajax 站点中那样工作。

Another thing that comes to my mind is to use the debugger; keyword in the view, though I am not 100% sure it will work as in ASP.NET ajax site.

贱人配狗天长地久 2024-10-17 07:12:58

单击要调试的代码,然后按 F9。

Click to the code where you want to debug and than press F9.

抱猫软卧 2024-10-17 07:12:58

UpTheCreek,

这并不是一个“好”的方法,但是,您可以在您的视图中插入一些“触发器”代码,可以在其中放置一个断点,然后从那里开始。该代码不一定必须执行某个功能(显然,如果执行该功能将会很有用)。

不管怎样,你不想要面包屑,所以这是(一顿)交易:

<%
    int rspId = 0;
    string uniqPageId = Guid.NewGuid().ToString().Replace("-", "");  
%>

然后,只需将断点放在任何这些变量定义的旁边。

不干净,绝对是“jfar”降价候选者:-)

UpTheCreek,

Not really a 'nice' way to do it, however, you can insert some 'flip-flop' code in your view that CAN have a breakpoint placed in it and then step from there. This code doesn't neccessarily have to perfom a function (tho obviously, would be useful if it did).

anyway, you don't want the crumbs, so here's the (meal) deal:

<%
    int rspId = 0;
    string uniqPageId = Guid.NewGuid().ToString().Replace("-", "");  
%>

then, simply place the breakpoint at the side of any of those variable definitions.

Not clean and definately a 'jfar' markdown candidate :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文