views:

915

answers:

7

I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening?

I've checked all the usual suspects (Debug build is on for all projects) and recompiled all projects in solution...

A: 

Have you tried deleting your bin directories before recompiling?

IainMH
+1  A: 

I would ensure that the UI layer is referencing the appropriate 'debug' .dll's. I'd also consider pressing CTRL+ALT+U (Modules View) when you're debugging to see if symbols are loaded for your BLL and DAL .dlls. If not then Visual Studio is unable to find .PDBs for that file. Are debug files (.PDBs) in the same directory as the .dlls that are being referenced from the Modules window?

Tyler
+1  A: 
  • Attach the debugger to ASP.NET process and click on the modules window. Ensure that debugging symbols are loaded for the assemblies you want to debug.
  • Make sure the UI is referencing the debug assemblies, not release assemblies.
  • Make sure the .PDB files are in the /bin/debug/ directory
  • Make sure you rebuild the entire solution before attaching the debugger.
  • If the data tier is in a seperate solution, add the project to the UI SLN (You don't need to add a reference, those should already be established or your code wouldn't compile), so that the debugger can pull up the full code.
FlySwat
+1  A: 

Thanks for the responses and ideas guys - I had already tried all of those or variations of them.

I think that it must be a very subtle VS bug. A colleague suggested I make the function that I was trying to break on public (previously "undefined" so was implicitly private) and try again. I did this and the breakpoint started to get hit. I then removed the public keyword and the breakpoint continued to be hit. No idea why this solved it but it did.

Thanks for you help!

Guy
A: 

A couple of suggestions. The first one is to check the status of the breakpoint in the source line. Is it a solid red ball? If not, it generally indicates that the file in question isn't the one used for the build. Secondly - have a look at the modules view and see what module and symbols have been loaded. You may find it's not what you expect.

As for why - I've no idea!

Nick

Nick R
A: 

I am having the same problem, and am working my way through the fixes above, but my break point is a solid ball, so that bit of informaiton is not very helpful! Also Symbols have all been loaded correctly, i have deleted the pcb, and dll, and regenerated, and cleared out my temp ASP directory (C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files*.*).

A: 

I had the same issue and kept thinking "what did I change in web.config" to potentially do this?

  <location path="." inheritInChildApplications="false">

That was not allowing breakpoints to work for me.

Jack Marchetti