如何补救“当前不会命中断点.没有为此文档加载任何符号."警告? [英] How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

查看:33
本文介绍了如何补救“当前不会命中断点.没有为此文档加载任何符号."警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个 C# 桌面应用程序(在 Visual Studio Express/Community 版上)可以工作,但 5 秒后就没有工作了.

A C# desktop application (on the Visual Studio Express/Community edition) worked, but then it didn't work 5 seconds later.

我尝试了以下方法:

  • 确保在所有程序集上设置调试配置、调试标志和完整的调试信息.
  • 从我的整台机器中删除所有 bin 和 obj 文件夹以及与项目相关的所有 DLL 文件.
  • 从头开始重新创建导致问题的项目.
  • 重启.

我在解决方案中有两个 Windows 窗体项目.其中一个加载调试信息,一个不加载.它们都引用了我试图在项目文件中以完全相同的方式获取调试信息的程序集.有什么想法吗?

I have two Windows Forms projects in the solution. One of them loads the debug information, one doesn't. They both refer to the assembly I'm trying to get debug information on in exactly the same way in the project file. Any ideas?

我想在这里补充一下,当我回来查看这个问题时,主要是为了我自己,在加载程序集之前不会加载符号,并且在需要它之前不会加载程序集.如果断点位于仅在主程序集中的一个函数中使用的库中,则在调用该函数之前不会加载符号(并且它将显示断点未命中).

I want to add here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.

推荐答案

开始调试,一旦你到达断点或使用 Debug >Break All,使用Debug >窗户>模块.您将看到加载到进程中的所有程序集的列表.找到您要为其获取调试信息的那个.右键单击它并选择符号加载信息.您将看到一个对话框,其中列出了它在其中查找程序集的 .pdb 文件的所有目录.根据实际的 .pdb 位置验证该列表.确保它没有找到旧的.

Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All, use Debug > Windows > Modules. You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.

在普通项目中,程序集及其 .pdb 文件应始终由 IDE 复制到与 .exe 相同的文件夹中,即项目的 binDebug 文件夹.如果您一直在使用它,请确保将其从 GAC 中删除.

In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe, i.e. the binDebug folder of your project. Make sure you remove one from the GAC if you've been playing with it.

这篇关于如何补救“当前不会命中断点.没有为此文档加载任何符号."警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆