views:

299

answers:

1

I have an MVC web application. I get an "Object reference not set to an instance of an object" error in line 16 below. It's a master page file. When I try to place a breakpoint in that line or anywhere in the file, I get a "this is not a valid location for a breakpoint" error. I have clicked on every line and I can't place a single breakpoint. I do have lines which have code only.

How do I place a breakpoint in this file?

Note: I can place breakpoints in code files. In some other aspx files, I can place a breakpoint in some code lines and some not. Does the inline code have to be in a special format to place a breakpoint? Using VS 2010 in Windows 7 64bit.

Code:

Line 14:   <div id="<%= Model.PageWidth %>" class="<%= Model.PageTemplate %>">
Line 15:     <div id="hd">
Line 16:       <h1><a href="/"><%= Model.Workspace.Title %></a></h1>
Line 17:       <h2><%= Model.Workspace.Subtitle %></h2>
Line 18:     </div>
+1  A: 

Look at this post: http://stackoverflow.com/questions/301658/break-points-aspx-pages

Dustin Laine
There are other lines of code on the page. Why is VS not allowing breakpoints. MVC apps have lots of code in aspx pages.
Tony_Henrich
Check my updated answer.
Dustin Laine
That's a real kludge to insert and remove that line every time I want to use a breakpoint. Are MVC developers happy with this process?
Tony_Henrich
I can't speak for MVC developers, but it also applies to webforms.
Dustin Laine