开发者

Why can't I set a breakpoint in a ASP.NET view?

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 no开发者_开发技巧t a valid location for a breakpoint' from VS2008. Why is this?


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.


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.


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


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 :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜