Visual Studio中断点警告 [英] Visual Studio Breakpoint Warning

查看:329
本文介绍了Visual Studio中断点警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试我的代码,我经常扔断点检查局部变量的值,以确保一切都在正确的轨道上。

When debugging my code, I often throw breakpoints in to check the values of local variables to make sure everything is on the right track.

最近,当我做改变我的代码并重新编译,我所有的断点变成一个圆(而不是一个完整的红圈)的轮廓,这让我读取错误;

Lately, when I make changes to my code and recompile, all my breakpoints turn into the outline of a circle (instead of a full red circle) and it gives me an error that reads;

断点将目前尚未受到打击。没有可执行的代码与此线路关联
。可能的原因包括:有条件的
编译或编译器优化

The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: conditional compilation or complier optimizations.

关于这个问题,我可以简单地删除和添加什么奇怪断点,一切都将彻底的工作很好。

What's strange about this issue is that I can simply remove and add the breakpoint and everything will work completely fine.

我没有使用任何类型的条件编译或编译器优化。有谁知道这意味着什么或如何解决这一问题?它变得很烦人的更换,每次我编译10-12断点。

I am not using any type of conditional compilation or complier optimizations. Does anyone know what this means or how to fix this? It gets quite annoying replacing 10-12 breakpoints each time I compile.

推荐答案

这情况可能有几个原因。

This can happen for a few reasons


  • 调试器使用的代码,该应用程序正在运行

  • 是代码不同
  • PDB文件的调试器使用的是应用程序正在运行

  • 从代码不同
  • 运行应用程序进行了优化的代码和调试信息已经被剥离出来。

  • 在其上还没有被加载到进程尚未有断点的代码(假设上面的东西都不是匪徒)

  • 如果要连接调试器,要注意什么样的.NET Framework它连接到(我不得不使用.NET 4与它的问题时,代码是所有的.NET 2.0)

  • 您已经组装也是在GAC。这可能发生,如果说您安装的程序,所以你可以调试它,但安装程序把DLL在GAC中。

  • 取出参考,并重新添加它(感谢的 forsvarir )。一般来说,当被引用的项目不是在解决方案中发生这种情况,和VS将DLL从其他项目的bin目录复制。你会知道这是问题,当您尝试重新添加引用,并不能找到项目:)

  • The code the debugger is using is different from the code that the application is running
  • The pdb file that the debugger is using is different from the code that the application is running
  • The code the application is running has been optimized and debug information has been stripped out.
  • The code in which you have breakpoints on hasn't been loaded into the process yet (assuming the things above are not the culprits)
  • If you are attaching the debugger, pay attention to what .net framework it's attaching to (i've had issues with it using .net 4 when code was all .net 2.0)
  • The assembly you have is also in the GAC. This might happen if say you installed your program so you could debug it, but the installer put the dll in the GAC.
  • Remove the reference and re-add it (thanks to forsvarir). Typically this occurs when the project that is referenced is not in the solution, and VS will copy the dll from the bin directory of another project. You will know this was the issue when you try to re-add the reference, and can't find the project :)

这是非常艰难弄清楚是怎么回事就在这里,但我会建议使用融合日志查看器来查看正在下载什么,在哪里它正在从加载,然后你可以看一下DLL,看看它的旧代码,等等。

It's pretty tough to figure out what's going on here, but i would suggest using the fusion log viewer to see what is being loaded and where it's being loaded from and then you can look at the dll and see if it's old code, etc.

这篇关于Visual Studio中断点警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆