简体   繁体   English

Visual Studio调试错误?

[英]Visual Studio debugging bug?

I am trying to debug a unit test. 我正在尝试调试单元测试。 When I step into the code of the class I want to test VS2008 show the disassembly rather than the source. 当我进入该类的代码时,我想测试VS2008,显示反汇编而不是源代码。 I have checked in the modules window and the status for the module in question reads "symbols loaded" so everything looks OK 我在模块窗口检查,有问题的模块状态显示为“加载符号”,让一切看起来 OK

The project is c#, I am using Visual Studio 2008 SP1, anyone got any ideas, it is driving me nuts! 该项目是c#,我正在使用Visual Studio 2008 SP1,任何人都有任何想法,这让我发疯了!

Symbols and source code is not the same thing. 符号和源代码不是一回事。 You need either have the source code for your module in the same place on disk it was on the build machine, or set up the source server: http://msdn.microsoft.com/en-us/magazine/cc163563.aspx 您需要将模块的源代码放在与构建计算机相同的磁盘上,或者设置源服务器: http : //msdn.microsoft.com/zh-cn/magazine/cc163563.aspx

If you right click in the source window, there will be a context menu option "Go To disassembly". 如果在源代码窗口中右键单击,将有一个上下文菜单选项“转到反汇编”。 That will show you what your looking for. 那会告诉你你在寻找什么。 Though, typically most people tend to ask how to get to source code from disassembly, not how to get to disassembly from source code! 虽然,通常大多数人往往会问如何拆卸源代码,而不是如何从源代码到拆卸! :) :)

@Grzenio is correct in that if you have the source and symbols and are still seeing dissassembly, something is out of whack. @Grzenio是正确的,因为如果您拥有源代码和符号并且仍然看到反汇编,则说明有些错误。

Try checking for versions of the dll in the global assembly cache (GAC). 尝试检查全局程序集缓存(GAC)中dll的版本。 You might also find other clues by checking the properties of any custom dlls that have been referenced. 您还可以通过检查已引用的任何自定义dll的属性来找到其他线索。 Specifically the properties "Specific Version" and "Copy Local". 特别是属性“特定版本”和“本地复制”。 If either of these values are true, it could be a clue that the project references a GAC'd copy of a dependency dll. 如果这些值中的任何一个为true,则表明该项目引用了GAC复制的依赖项dll的一个线索。

Old post, but had this issue recently... Delete the reference to the project for which you want to step through from the project calling the reference. 旧帖子,但最近有此问题...从调用引用的项目中删除要逐步执行的项目的引用。 Clean the solution, rebuild everything (which I like to do one project at a time when I have this issue). 清理解决方案,重新构建所有内容(遇到此问题时,我希望一次执行一个项目)。 Add the reference again - ensuring you are adding the reference as a project reference and not directly referencing the .dll. 再次添加引用-确保您将引用添加为项目引用,而不是直接引用.dll。

You can also try going to the debug settings and uncheck "Enable address-level debugging" under Debugging | 您也可以尝试进入调试设置,然后在“调试” |“调试”下取消选中“启用地址级调试”。 General. 一般。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM