Why does Visual Studio sometimes not go to my brea

2019-07-08 09:53发布

问题:

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 advance!!

回答1:

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).



回答2:

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.



回答3:

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



回答4:

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.



回答5:

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