breakpoint will not currently be hit, why not?

2019-06-15 11:48发布

Sometimes I get the message that the breakpoint will not be hit, and no symbols will be loaded.

The red icon in vs.net changes color, and the debug mode just doesn't work.

what is the reason for this?

9条回答
何必那么认真
2楼-- · 2019-06-15 12:16

What does it say when you hover the mouse over the disabled breakpoint? It will usually tell you the problem. My favorite is the old 'source code is out of date', especially when I'm debugging a DLL. Another favorite is when the file you're looking at isn't the one you're debugging (a copy in another folder?). If it's a case where you can breakpoint a caller routine, but not the callee, stepping into the callee will force VS to open the 'proper' source file and you'll be able to set breakpoints. Confusing, I usually swear at VS at this point, it seems to help.

查看更多
混吃等死
3楼-- · 2019-06-15 12:24
  1. for manage code only - theres a good answer for this problem on the following site: http://geekswithblogs.net/dbutscher/archive/2007/06/26/113472.aspx
  2. for native + managed code - in the startup solution properties-> Debug tab make sure that "enable unmanaged code debugging" check box is checked
查看更多
Deceive 欺骗
4楼-- · 2019-06-15 12:29

This can happen if the symbol fiels are different from the assembly (remote debugging), or when there is no "direct path", so the assembly hasent been load, but might be loaded using reflection and loading of the required assembly at run time.

查看更多
▲ chillily
5楼-- · 2019-06-15 12:29

I resolved this problem by selecting Automatic:Native Code for the "Attach to" field in "Attach To Process" formenter image description here

查看更多
叛逆
6楼-- · 2019-06-15 12:33

I had the same problem. Which I know is normally if the build versions are different, and something isn't matching up. I cleaned my project, rebuilt it, and then deployed and that got everything back in-sync.

查看更多
孤傲高冷的网名
7楼-- · 2019-06-15 12:36

Do each bullet in the link below ONE AT A TIME, but repeat my steps below with each one you try.

http://web.archive.org/web/20140212130754/http://carnotaurus.philipcarney.com/post/4130422114/visual-studio-debugging-issue-with-files-of-the-same

1.) Stop debugging (press red square icon) in Visual Studio
2.) Clean Solution
3.) Build Solution
4.) [INSERT BULLET INSTRUCTION HERE]
5.) Tools > Attach to Process (or start with debugging)
6.) Start the program that you're attaching to, and run it such that your code will get hit

6 explained:

If attaching to nunit.exe, then open NUnit and run a test so your breakpoint will be hit

If attaching to w3wp.exe (IIS site), then open your site in the browser and go to the page that will hit your breakpoint

查看更多
登录 后发表回答