摆脱“当前位置没有可用的源代码。”
好吧,这是我自己的错,但我似乎无法拯救自己。
每当我尝试进入一个包含调用 .NET 代码的赋值字段的类时,我都会看到一个对话框,其中包含文本“当前位置没有可用的源代码。”:
例如,进入以下类的构造函数会给我上述消息:
public class Test
{
private Stack<String> _Dummy = new Stack<String>();
public Test() { }
}
我认为这是因为在某些时候我摆弄了符号服务器的设置,但无论我现在摆弄什么,我似乎都无法摆脱该消息。
我的愚蠢在哪里忘记了自己做了什么?
我当前的摘要 选项:
- [ ] 启用地址级调试
- [x] 启用仅我的代码(仅限托管)
- [ ] 启用 .NET 框架源步进
- [ ] 启用源服务器支持
- 符号文件 .pdb 位置 - 空
- 缓存来自符号服务器的符号到此目录:C:\temp(空)
OK, this is my own fault, but I can't seem to rescue myself.
Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":
For instance, stepping into the constructor of the following class would give me the above message:
public class Test
{
private Stack<String> _Dummy = new Stack<String>();
public Test() { }
}
I assume this is because at some point I fiddled with the settings for the symbol server, but no matter what I fiddle with now, I can't seem to get rid of that message.
Where has my stupidity forgotten what it did?
Summary of my current options:
- [ ] Enable address-level debugging
- [x] Enable Just My Code (Managed Only)
- [ ] Enable .NET framework source stepping
- [ ] Enable source server support
- Symbol file .pdb locations - empty
- Cache symbols from symbol servers to this directory: C:\temp (empty)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(17)
我在非托管 C++ 程序中遇到了同样的问题:当调试器位于 main 函数中时,它总是显示“没有可用的源代码”,有趣的是,该文件中的其他函数显示没有问题。 在这种情况下,问题是我在堆栈上分配了太多数据。 减少后,调试器开始工作,没有问题。
这是在 Visual Studio 2010 中。
I had the same problem in an unmanaged C++ program: when debugger was in
main
function it always showed "No source code available" and, what was interesting, other functions in this file was shown without problems. In this case, the problem was that I allocated too much data on the stack. After reducing it, the debugger started to work without problems.It was in Visual Studio 2010.
一种也适用于 Visual Studio Express 版本(例如 Visual Basic 2005 Express Edition)的方法是重命名
.suo
文件。 它与解决方案文件.sln
位于同一文件夹中。 重命名文件之前退出 Visual Studio。.suo
文件包含非关键设置,如窗口位置等。但是,它还包含所有断点,这就是为什么重命名它可能比删除它更好,以防万一此操作后悔。One way, that also works for Express Editions of Visual Studio (say, Visual Basic 2005 Express Edition), is to rename the
.suo
file. It is in the same folder as the solution file,.sln
. Exit Visual Studio before renaming the file.The
.suo
file contains non-critical settings, like window positions, etc. However, it also contains all the breakpoints which is why it is probably better to rename it than delete it in case this action is regretted.我就是这样解决的。
右键单击您的项目 -> 属性-> 编译-> 高级编译选项...
然后从下拉菜单中将“生成调试信息”设置为“完整”。
希望有帮助。
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.
这对我有用:
This worked for me:
您是否尝试过构建该页面? 我遇到了与 AjaxControlToolkit: Modal Popup Extender 类似的问题。 直到我给它 CSS 和 ASP.NET 控件后,它才显示出来。
Have you tried to build that page? I had an issue with something similar with AjaxControlToolkit: Modal Popup Extender. It did not show until I gave it CSS and ASP.NET controls.
由于某种原因,我在 VS 2017 中禁用了所有
公共语言运行时异常
。要解决此问题,请打开“调试”>“异常设置”下的
异常设置
。 窗口> 异常设置并在异常设置
窗口中标记公共语言运行时异常复选框I had for some reason disabled all the
Common Language Runtime Exceptions
in VS 2017.To fix this, open the
Exception Settings
under Debug > Windows > Exception Settings and mark the checkbox Common Language Runtime Exceptions in theException Settings
window我遇到了同样的问题,它告诉我错误出在 AjaxControlToolkit 上,但问题出在我的 HTML 语法中,特别是在 div 标记中,我只放置了关闭标记 '' 而没有打开标记
I had the same issue, It showed me that the error is on AjaxControlToolkit, but the problem was in my HTML syntax, especially in a div tag, I was putting only the close tag '' without the opening tag
由于测试项目和主项目的框架版本不同,我遇到了这个问题。 当升级主项目框架版本时,一定不要忘记升级测试项目。
I ran into this problem because of difference between framework versions of test projects and main projects. When upgrading main projects frameworks version, be sure to not forget to upgrade test projects.
我在 VS 2017 C++ 中遇到了这个问题
TLDR:它正在访问超出限制的数据程序
在调试模式下完成并显示此消息:
wntdll.pdb not returned
修复后它与
这个答案
开始显示消息:没有源代码可用于当前位置
但也弹出一条消息说:
app.exe已触发断点
,但断点不在我的源代码中,它在源代码中VS在调试模式下生成,在源代码中右键
->转到反汇编
,断点是int 3
指令最后,这只是一个堆栈溢出,因为代码访问数据超出了限制,我只是修复了代码并且消息消失了
我想 VS 没有显示有关访问超出限制的数据的错误,因为我正在使用 Winapi 函数
GetEnvironmentStrings()
并在站点中显示:将此内存视为只读; 不要直接修改它
,我正在修改它:)I had this problem in VS 2017 C++
TLDR: It was accesing data beyond the limit
The program finished in debug mode and it showed this message:
wntdll.pdb not loaded
After fixing it with
this answer
it started to show the message:There is no source code available for the current location
But also there was a message that popped saying:
app.exe has triggered a breakpoint
, but the breakpoint was not in my source code, it was in the source code generated by VS in debug mode,Right click
in the source code ->Go to Disassembly
and the break point wasint 3
instructionAt the end it was just a stack overflow, since the code was accesing data beyond the limit, I just fixed the code and the messages were gone
I guess VS didn't show an error about accesing data outside the limit because I was using Winapi function
GetEnvironmentStrings()
and in the site says:Treat this memory as read-only; do not modify it directly
and I was modifying it :)我遇到了同样的问题,我用这种方式解决了它(Visual Studio 2008):
“Formato de la informacion de depuracion”到“Base de datos de programa (/Zi)”
I had the same problem, and I solved it on this way (Visual Studio 2008):
"Formato de la informacion de depuracion" to "Base de datos de programa (/Zi)"
查看是否有一些源文件被意外排除。 执行解决方案的属性并查看“通用属性”下的“调试源文件”部分。
See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.
在解决方案资源管理器中,检查“通用属性”、“调试源文件”下的解决方案属性页。 如果您看到“不要查找这些源文件:”下列出的程序集,请将其删除,问题就会消失。
打开解决方案属性页
选中“不要查找这些源文件” "
In Solution Explorer, check your solution property page under Common Properties, Debug Source Files. If you see the assembly listed under "Do not look for these source files:", delete it and the issue should go away.
Open the solution property page
Check "Do not look for these source files"
如果您不想调试 .NET 程序集,避免“当前位置没有可用源”问题的快速解决方法是取消选中“工具 -> ”下的“要求源文件与原始版本完全匹配”复选框。 选项-> 调试-> 一般的
If you do not want to debug .NET assembly, a quick fix to avoid "No source available to current location" problem is to uncheck "Require source files to exactly match the original version" check-box under Tool -> Options -> Debugging -> General
这是我为解决这个问题所做的事情。 首先,停止调试并在 VS 中打开您的解决方案。 接下来,确保您的解决方案配置设置为“调试”而不是“发布”。 然后简单地进行重建(不是构建,重建)。 下次启动调试器时,它应该正常运行,并且您不应该收到该错误消息。
希望这可以帮助!
Here's what I did to solve this problem. First, stop debugging and just have your solution open in VS. Next, make sure your solution config is set to Debug as opposed to Release. Then simply do a Rebuild (not Build, Rebuild). The next time you fire up the debugger, it should function as normal and you shouldn't get that error message.
Hope this helps!
如果您不希望出现这个烦人的选项卡,您可以尝试我创建的这个附加组件:
http://erwinmayer.com/labs/ Visual-studio-2010-extension-disable-no-source-available-tab/
它可以直接在 Visual Studio Gallery 上下载:
http://visualstudiogallery.msdn.microsoft.com/en -us/fdbb2036-471e-40a7-b20e-31f8fd5578fa
If you don't want this annoying tab to appear, you can try this add-on that I created:
http://erwinmayer.com/labs/visual-studio-2010-extension-disable-no-source-available-tab/
It is directly downloadable on the Visual Studio Gallery:
http://visualstudiogallery.msdn.microsoft.com/en-us/fdbb2036-471e-40a7-b20e-31f8fd5578fa
检查您的项目是否有项目引用,而不是 DLL 引用! 如果存在 DLL 引用,则引用的项目将无法识别您的更改,并且您将收到与您类似的错误消息。
Check if your projects have a project reference, not a DLL reference! If there exists a DLL reference, your changes will not be recognized by your referenced project, and you will get an error message like yours.
这个错误也让我抓狂了。 我正在使用“AjaxControlToolkit”,并使用“添加引用”将其引用到我的项目中。
我删除了“AjaxControlToolkit”引用并添加了与“添加现有项目”相同的引用,之后我就没有任何问题了......
This error made me go crazy as well. I was using 'AjaxControlToolkit' and had referenced it using 'Add Reference' to my project.
I deleted the 'AjaxControlToolkit' reference and added the same with 'Add Existing Item' and after that I had no problems at all...