views:

369

answers:

5

Hi,

I have been using Visual Studio 2005 and 2008 and i have noticed that sometimes when i place break point in my code that it does not want to go to the break point. So i restart my PC and then it works again. Its like something get's stuck? Does this only happen to me??? How can i prevent this! It is driving me nuts!!

Thanks in advanced!!

+5  A: 

Often this is because the code you are looking hasn't been compiled since you placed the breakpoint, so you test code / unit test, is running against an outdated DLL.

This might be what's happening to you.

Check out your build manager, and make sure all the projects are checked.

Edit: Go to Build->Configuration Manager and make sure the [Build] checkboxes are all checked, that will ensure that every project is compiled when you build the solution (Ctrl+shift+b).

Arkain
What is it that i must check for in the Configuration Manager by the Build Tab on top?
Etienne
+1 because it's definitely because the code is out of date. The reasons why depends on your solution and project set up and are varied.
Richard Hein
A: 

Instead of rebooting your computer try selecting build -> rebuild solution and then running in debug mode. That usually seems to clear out little annoying things like that.

John
I always do this......... but sometimes it does get stuck.
Etienne
+2  A: 

It depends on if you are developing a web application, or if you have late bound code, changes in controls from another project, etc.... One way to track down problems is to look in the Debug - Windows - Modules pane, and see which assembly is actually being used. If you have remoting boundaries to cross, the breakpoint won't become active until the code is executed. If you hover over the breakpoint when it is not coloured in completely and has that question mark, you can also get more information.

Hope that helps.

Richard Hein
+1 Very usefull trick.
Arkain
A: 

There's a hotfix for various debugger problems in VS 2008 SP1, have you tried that?

nikie
Yip, i do have SP1 installed. But its not just VS2008, i have expereince this with VS2005 as well and as well as on diff. PC's.
Etienne
A: 

I had the same problem with VS 2005.

Apparently Visual Studio's setting were corrupted. I reset them from Tools/Import and Export Settings/Reset all settings. It's now breakpointing fine.

Mike