为什么无法在 ASP.NET 视图中设置断点?
如果我在编译的代码中设置断点(例如在操作中),我就可以单步执行,并最终单步执行视图的生成。
我曾多次发现这很有用,但它很乏味,因为您必须逐步执行大量代码才能到达那里。
但是,我无法在视图中设置断点。我刚刚收到来自 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
右键单击要中断的代码,然后转到“断点 -> 插入断点”。
为什么?一定与您不使用纯代码文件并且点击左侧边栏不知道要使用哪个代码块的情况有关。
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.
我想到的另一件事是使用调试器;视图中的关键字,尽管我不能 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.
单击要调试的代码,然后按 F9。
Click to the code where you want to debug and than press F9.
UpTheCreek,
这并不是一个“好”的方法,但是,您可以在您的视图中插入一些“触发器”代码,可以在其中放置一个断点,然后从那里开始。该代码不一定必须执行某个功能(显然,如果执行该功能将会很有用)。
不管怎样,你不想要面包屑,所以这是(一顿)交易:
然后,只需将断点放在任何这些变量定义的旁边。
不干净,绝对是“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:
then, simply place the breakpoint at the side of any of those variable definitions.
Not clean and definately a 'jfar' markdown candidate :-)