摆脱“当前位置没有可用的源代码。”

发布于 2024-07-09 19:10:29 字数 779 浏览 13 评论 0原文

好吧,这是我自己的错,但我似乎无法拯救自己。

每当我尝试进入一个包含调用 .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.":

Screenshot of error message

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

溺渁∝ 2024-07-16 19:10:30

我在非托管 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.

堇年纸鸢 2024-07-16 19:10:30

一种也适用于 Visual Studio Express 版本(例如 Visual Basic 2005 Express Edition)的方法是重命名 .suo 文件。 它与解决方案文件 .sln 位于同一文件夹中。 重命名文件之前退出 Visual Studio。

突出显示 .suo 文件的 Windows 资源管理器的屏幕截图

.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.

Screenshot of Windows Explorer with a .suo file highlighted

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.

夜访吸血鬼 2024-07-16 19:10:30

我就是这样解决的。

右键单击您的项目 -> 属性-> 编译-> 高级编译选项...

然后从下拉菜单中将“生成调试信息”设置为“完整”。

希望有帮助。

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.

顾北清歌寒 2024-07-16 19:10:30

这对我有用:

  1. 在引用的 *.DLL 的属性页上检查“启用非托管代码调试”
  2. 重新编译引用的 *.DLL
  3. 删除然后将引用的 *.DLL 重新添加到您的项目中

This worked for me:

  1. Check the "Enable Unmanaged Code Debugging" on the properties page for the referenced *.DLL
  2. Recompile referenced *.DLL
  3. Remove and then re-add the referenced *.DLL to your project
放手` 2024-07-16 19:10:30

您是否尝试过构建该页面? 我遇到了与 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.

黑凤梨 2024-07-16 19:10:30

由于某种原因,我在 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 the Exception Settings window

晒暮凉 2024-07-16 19:10:30

我遇到了同样的问题,它告诉我错误出在 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

香橙ぽ 2024-07-16 19:10:30

由于测试项目和主项目的框架版本不同,我遇到了这个问题。 当升级主项目框架版本时,一定不要忘记升级测试项目。

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.

一袭白衣梦中忆 2024-07-16 19:10:30

我在 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 was int 3 instruction

At 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 :)

孤独患者 2024-07-16 19:10:30

我遇到了同样的问题,我用这种方式解决了它(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)"

Enter image description here

寒江雪… 2024-07-16 19:10:29

查看是否有一些源文件被意外排除。 执行解决方案的属性并查看“通用属性”下的“调试源文件”部分。

See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.

狼性发作 2024-07-16 19:10:29

在解决方案资源管理器中,检查“通用属性”、“调试源文件”下的解决方案属性页。 如果您看到“不要查找这些源文件:”下列出的程序集,请将其删除,问题就会消失。

打开解决方案属性页

在 Visual Studio 的解决方案资源管理器中右键单击解决方案的屏幕截图

选中“不要查找这些源文件” "

Visual Studio 解决方案中解决方案属性页的屏幕截图

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

Screenshot of right clicking on the solution in Visual Studio's Solution Explorer

Check "Do not look for these source files"

Screenshot of the solution property pages in Visual Studio solution

谁对谁错谁最难过 2024-07-16 19:10:29

如果您不想调试 .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

美人骨 2024-07-16 19:10:29

这是我为解决这个问题所做的事情。 首先,停止调试并在 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!

2024-07-16 19:10:29

如果您不希望出现这个烦人的选项卡,您可以尝试我创建的这个附加组件:
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

一念一轮回 2024-07-16 19:10:29

检查您的项目是否有项目引用,而不是 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.

勿忘心安 2024-07-16 19:10:29

这个错误也让我抓狂了。 我正在使用“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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文