简体   繁体   English

Visual Studio 2008:如何在调试时加载源代码

[英]Visual Studio 2008: How to load source code while debugging

When debugging in Visual Studio 2008 I get the error "There is no source code available for the current location" but it does not prompt me to browse for source code. 在Visual Studio 2008中进行调试时,我收到错误“没有可用于当前位置的源代码”,但它不会提示我浏览源代码。 If I click "Show Disasembly" and then right click to select "Go to source code" I get the error "The source code cannot be displayed. 如果我单击“显示Disasembly”,然后右键单击选择“转到源代码”,我收到错误“无法显示源代码。

How do I load the source code while in debug mode? 如何在调试模式下加载源代码?

Edit: I have the source code (it is just another class which is not part of this solution) and it is compiled in debug mode. 编辑:我有源代码(它只是另一个不属于此解决方案的类),它是在调试模式下编译的。

If you are debugging from a different location to where you originally built the solution, ie you have attached to a process which has debugging symbols: 如果从最初构建解决方案的位置进行调试,即已连接到具有调试符号的进程:

You can tell visual studio where the source is located by right clicking on the solution in the solution explorer and adding the path-to-your-source to the "Directories containing source code" under the "Debug Source Files". 您可以通过右键单击解决方案资源管理器中的解决方案并将“路径到源”添加到“调试源文件”下的“包含源代码的目录”,来告诉visual studio源所在的位置。

I have tried this under VS2008 only. 我只在VS2008下尝试了这个。

I just found the problem. 我刚发现了这个问题。 There was an incorrect reference in a project just checked in by another developer. 在刚刚由另一位开发人员签入的项目中有错误的引用。 This is why I hate solutions with 20 projects. 这就是为什么我讨厌20个项目的解决方案。

I have had similar messages when I was trying to debug a dll compiled in release mode. 当我尝试调试在发布模式下编译的dll时,我有类似的消息。 In these cases I just recompiled them in Debug mode. 在这些情况下,我只是在调试模式下重新编译它们。

Looks like you are trying to debug into something that you do not have the source code for. 看起来你正在尝试调试你没有源代码的东西。 See: this . 见: 这个

When this happens to me I just add that project to my solution. 当我遇到这种情况时,我只是将该项目添加到我的解决方案中。 Alternatively you should be able to load the assembly's PDB into your Symbols. 或者,您应该能够将程序集的PDB加载到符号中。

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

相关问题 如何在不调试的情况下使Visual Studio 2008服务器仍为服务器站点? - How can I have Visual Studio 2008 server still server site while not debugging? Visual Studio 2008中的调试问题 - Debugging issue in Visual Studio 2008 如何在Visual Studio中调试时强制执行异常? - How to force an exception while debugging in Visual Studio? 在Visual Studio 2010中调试源代码时发出的警告 - Warning given when debugging source code in visual studio 2010 为什么在从 Visual Studio 调试 ASP.NET Core 源代码时看不到堆栈中间的局部变量 - Why I cannot see local variables in the middle of the stack while debugging ASP.NET Core source code from Visual Studio 使用INotifyPropertyChanged在Visual Studio 2008中调试属性设置 - Debugging Property Settings in Visual Studio 2008 with INotifyPropertyChanged 如何在Visual Studio 2008中获取MySQL数据库选项作为数据源? - How to get MySQL Database option as a Data Source in Visual Studio 2008? 在Visual Studio中调试框架代码 - Debugging Framework Code in Visual Studio Visual Studio 2008:调试托管代码时,下一行的步骤非常慢 - Visual Studio 2008 : Step to next line is very slow when debugging managed code 适用于小型团队的Visual Studio 2008源代码控制 - Visual Studio 2008 source control for small teams
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM