简体   繁体   English

“无可用源” - Visual Studio调试(即使已加载符号)

[英]“No Source Available” - Visual Studio Debugging (even when symbols have loaded)

I have set up Visual Studio 2012 Professional to download debug symbols. 我已经设置了Visual Studio 2012 Professional来下载调试符号。 It is set up correctly and the symbols have downloaded. 它设置正确,符号已下载。

I get to the line of code I wish to step into: 我进入了我想要介入的代码行:

bool result = Membership.ValidateUser("user", "password");

I right click on it and choose step into specific-->Membership.ValidateUser() 我右键单击它并选择step into specific-->Membership.ValidateUser()

Then a tab opens in Visual Studio saying: 然后在Visual Studio中打开一个选项卡说:

No Source Available - There is no source code available for the current location 无可用来源 - 当前位置没有可用的源代码

Membership.ValidateUser() is in the System.Web.Security namespace which is in the System.Web.dll . Membership.ValidateUser()是在System.Web.Security命名空间这是在System.Web.dll If I open up the Modules window I can clearly see that the symbols for this assembly have been downloaded. 如果我打开模块窗口,我可以清楚地看到已经下载了该程序集的符号。

If the symbols are there, why am I not able to step into the source code? 如果符号在那里,为什么我无法进入源代码?

You may have the Symbols but you DON't have the source code. 你可能有符号,但你没有源代码。 PDB's are not sufficient for debugging but they are necessarily to link your source code with the executable. PDB不足以进行调试,但它们必须将源代码与可执行文件链接起来。 PDB's are good to report bugs because they provide detailed information of call stack, in order to debug though, you need to have the source code. PDB很好地报告错误,因为它们提供了调用堆栈的详细信息,但为了调试,您需要拥有源代码。

Source stepping is only available for RTM or SP releases. 源步进仅适用于RTM或SP版本。 See PDB files for .NET Framework 3.5 SP1 not available! 请参阅.NET Framework 3.5 SP1的PDB文件不可用! (ie System.Web.pdb 2.0.50727.4016) . (即System.Web.pdb 2.0.50727.4016)

I ran into the same problem and in my case it is version 4.0 and not 4.5, but still the same problem. 我遇到了同样的问题,在我的情况下它是版本4.0而不是4.5,但仍然是同样的问题。

After checking with fiddler it appears that for many DLL files the server at referenceserver.microsoft.com returns 404 and Visual Studio then falls back and downloads it from the Microsoft symbol server at msdl.microsoft.com which doesn't contains the actual source code. 在使用fiddler检查后,对于许多DLL文件,似乎referenceserver.microsoft.com上的服务器返回404,然后Visual Studio退回并从msdl.microsoft.com上的Microsoft符号服务器下载它,该服务器不包含实际的源代码。

So at the end of the day, source stepping with Microsoft's code doesn't appear to always work, and one might resort to using .NET Reflector . 因此,在一天结束时,使用Microsoft代码的源代码似乎并不总是有效,并且人们可能会使用.NET Reflector

I have just found another Stack Overflow answer, .NET framework source stepping not working despite options set , and according to it the problem might be related to SP1. 我刚刚发现了另一个Stack Overflow的答案, 尽管设置了选项.NET框架源步进仍无法正常工作 ,根据它,问题可能与SP1有关。

I had the similar problem, and this is how I solved it. 我有类似的问题,这就是我解决它的方法。

Right click your project -> Properties - > Compile -> Advanced Compile Options... 右键单击您的项目 - >属性 - >编译 - >高级编译选项...

Then Set 'Generate debug info' to 'Full' from the drop down menu. 然后从下拉菜单中将“生成调试信息”设置为“完整”。

Hope that helps. 希望有所帮助。

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

相关问题 C# Visual Studio 服务调试“当前不会命中断点。没有为此文档加载任何符号” - C# Visual Studio Service Debugging "The breakpoint will not currently be hit. No Symbols have been loaded for this document" 在没有 Visual Studio 的情况下进行调试,但可以使用源文件和 pdb 文件 - Debugging without Visual Studio, but source and pdb files available 调试.DMP时,Visual Studio 2008不加载符号 - Visual Studio 2008 not loading symbols when debugging a .DMP 即使加载了PDB,Visual Studio 2012也拒绝显示源代码 - Visual Studio 2012 refuses to show source, even with PDB loaded Visual Studio无可用来源 - Visual Studio No Source Available Visual Studio:调试引用的DLL,我在另一个SLN中有源代码 - Visual Studio: Debugging a referenced DLL, I have source in another SLN 使用Visual Studio 2017进行调试时,“请求在此上下文中不可用” - “Request is not available in this context” when debugging with Visual Studio 2017 调试 Visual Studio 扩展时,.pdb 文件不可用 - .pdb files not available when debugging Visual Studio Extension 在Visual Studio 2010中调试源代码时发出的警告 - Warning given when debugging source code in visual studio 2010 Visual Studio 2013 - 源不可用 - Visual Studio 2013 - Source Not Available
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM