Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

breakpoints in code behind not hit

common problem I guess, but no solution has worked so far:

my breakpoints (asp.net 2.0) get hit nicely in "backend" assemblies but not in the code behind.

i can even see the <% Response.CacheControl="no-cache"; %> line being hit in my asp.net master file but still not the code behind.

I'm using VS 2005, windows 7 32 bit. Any idea what else could I check?

like image 297
Greg Avatar asked May 19 '11 13:05

Greg


People also ask

Why are my breakpoints not being hit?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

What does a breakpoint do to your code?

Set a Temporary breakpoint This breakpoint lets you break the code only once. When debugging, the Visual Studio debugger only pauses the running application once for this breakpoint and then removes it immediately after it has been hit.


2 Answers

If your code file is newer than the compiled version that is being run against (on the web server, whether it be IIS or the dev server), breakpoints will not be hit (the red circles will be hollow).

Try doing a clean / rebuild and see if that works.

EDIT:

I just noticed something in your last comment; you said you are attaching to the asp.net process. To which process are you attaching? It should be w3wp.exe.

like image 113
Mark Avenius Avatar answered Oct 05 '22 13:10

Mark Avenius


My problem ended up being that I'd created a new configuration for the project, but that none of the debug properties on the project were set for it. So this is what I had to do:

  1. Right click the web project and select Properties.
  2. Go to the Build tab.
  3. Click Advanced.
  4. In the dialog, ensure that in the Output section, Debug Info is NOT set to none.
like image 44
GotDibbs Avatar answered Oct 05 '22 11:10

GotDibbs