breakpoints in code behind not hit
Solution 1
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.
Solution 2
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:
- Right click the web project and select Properties.
- Go to the Build tab.
- Click Advanced.
- In the dialog, ensure that in the Output section, Debug Info is NOT set to none.
Solution 3
I'm guess there is a problem in loading the symbols for the page, and hence the breakpoint is not hitting,
try this
1 - While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
2 - Look for your project's DLL, and check the Symbol Status for it.
3 - If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
4 - I've found that it's sometimes necessary to
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
hope it helps !
Solution 4
Ugh. In my case I had mapped the right folder in IIS, but the application was set on IIS Express.
So the correct assemblies where loaded when I went to the URL, but the application was attached to a IIS Express version that never got any hits.
Greg
Programming, cursing, riding my bikes and learning foreign languages.
Updated on June 04, 2022Comments
-
Greg about 2 years
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?
-
Devjosh about 13 yearstry to run it in different browser if it helps
-
Greg about 13 yearsworks nicely when i debug the source directly instead of attaching to the asp.net process.
-
Devjosh about 13 yearsand what if you make other browsers default i.e. in the asp.net process then ?
-
-
Greg about 13 yearscan it be app_code.dll in framework\v2...\Temporary Asp.net files\? I cleaned all the files there, published the web app again, still no luck...
-
painotpi about 13 yearscan you put a break point in you code-behind, and debug the solution, just hover over the breakpoint, you'll get some hint as to what's wrong.
-
Greg about 13 yearsit is actually more of codefile than codebehind. no symbols loaded. Do you have any experience with ASP.NET though?:)
-
painotpi about 13 yearsyup, had the same "no symbols loaded" problem, then I did what I've posted :)
-
Greg about 13 yearsin aspx.cs files?:) aren't they compiled dynamically or what? if not, no idea in what dll they are compiled into
-
GotDibbs about 10 years@TarunPai That tip with the modules window was super helpful. Thanks!
-
curiousBoy about 8 yearsSetting "Output" section, "Debug Info" to "PDB only" worked!