C# 如何解决“当前不会命中断点。此文档未加载任何符号”。警告?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2155930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I remedy the "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?
提问by Instance Hunter
C# desktop application on the express edition worked then didn't work 5 seconds later.
Express 版上的 C# 桌面应用程序工作,然后在 5 秒后无法工作。
I tried the following:
我尝试了以下方法:
- Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
- Delete all bin and obj folders and all DLLs related to the project from my entire machine.
- Recreate projects causing the problem from scratch.
- Reboot.
- 确保在所有程序集上设置调试配置、调试标志和完整调试信息。
- 从我的整个机器中删除所有 bin 和 obj 文件夹以及与项目相关的所有 DLL。
- 从头开始重新创建导致问题的项目。
- 重启。
I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?
我的解决方案中有两个 WinForms 项目。其中之一加载调试信息,一个不加载。它们都指的是我试图在项目文件中以完全相同的方式获取调试信息的程序集。有任何想法吗?
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.
我想在这里补充一下,主要是为了我自己回来回顾这个问题时,符号在程序集加载之前不会加载,并且程序集在需要时才加载。如果断点位于仅在主程序集中的一个函数中使用的库中,则在调用该函数之前不会加载符号(并且它将显示断点未命中)。
采纳答案by Hans Passant
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.
开始调试,一旦到达断点或使用Debug > Break All
,请使用Debug > Windows > Modules
. 您将看到加载到进程中的所有程序集的列表。找到您想要获取调试信息的那个。右键单击它并选择符号加载信息。您将看到一个对话框,其中列出了为程序集查找 .pdb 文件的所有目录。根据实际 .pdb 位置验证该列表。确保它没有找到旧的。
In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it.
在普通项目中,程序集及其 .pdb 文件应始终由 IDE 复制到与 .exe 相同的文件夹中。项目的 bin\Debug 文件夹。如果您一直在使用它,请确保从 GAC 中删除它。
回答by Patrick
Just something simple to try - you may have tried it already. Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution.
只是一些简单的尝试 - 您可能已经尝试过。右键单击解决方案资源管理器中的解决方案,单击“清理解决方案”,这将删除与解决方案关联的所有已编译和临时文件。
Do a rebuild of the solution and try to debug again.
重建解决方案并尝试再次调试。
I've also had troubles with breakpoints multiple projects in a solution - some compiled as x86, some as x64.
我也遇到了解决方案中的多个项目的断点问题 - 有些编译为 x86,有些编译为 x64。
回答by Andrus
Option "Start debugging, Debug + Windows + Modules" does not exist in Microsoft Visual Studio Express 2013 edition.
Microsoft Visual Studio Express 2013 版本中不存在选项“开始调试,调试 + Windows + 模块”。
Unchecking "Use Managed Compatibility Mode"in Tools Options Debugging fixes this.
在工具选项调试中取消选中“使用托管兼容模式”可解决此问题。
回答by WindyHen
[WINCE] I happened to encounter this during build on WinCE, it seemed that the 'Clean' did not clean the target folder on the device, I got the debug/break back by changing the Output folder on Devices (Project Properties-->Devices tab-->change Output folder to other than the previous failed debug) -- and voila!! it works. Might have to do manual cleanup on the device, but that will be later.
[ WINCE] 我在 WinCE 上的构建过程中碰巧遇到了这个问题,似乎“清理”没有清理设备上的目标文件夹,我通过更改设备上的输出文件夹(项目属性 - >设备选项卡--> 将输出文件夹更改为之前失败的调试以外的其他文件夹)- 瞧!!有用。可能需要在设备上进行手动清理,但稍后会进行。
Hope this help.
希望这有帮助。
回答by Karthik
The Following steps forked for me:
以下步骤为我分叉:
- Go to the "bin" folder of your project.
- Delete the "Debug" folder.
- Build your project again.
- The Debug folder will get re-created.
- 转到项目的“bin”文件夹。
- 删除“调试”文件夹。
- 再次构建您的项目。
- 将重新创建 Debug 文件夹。
Now you can start debugging again.
现在您可以再次开始调试。
回答by Farshid
I test all answers for this question not work for me, I use this below method:
我测试了这个问题的所有答案对我不起作用,我使用以下方法:
I exclude that file(s) has breakpoints from project where that visual studio can't hits them and then I includes them into my project and worked breakpoints.
我从项目中排除了该文件具有该 Visual Studio 无法命中它们的断点,然后我将它们包含到我的项目和工作断点中。
回答by LuisEduardoSP
I had this problem.
我有这个问题。
My issue was that the aspx, aspx.vb and aspx.designer.vb files were imported wrong (Perhaps they were imported one by one to the project).
我的问题是aspx、aspx.vb和aspx.designer.vb文件导入错误(可能是一一导入到项目中)。
The breakpoint were in the aspx.vb, but was unreachable and had the warning of this question.
断点在 aspx.vb 中,但无法访问并有此问题的警告。
The solution was to delete the three files and import them again. Now I can reach the breakpoint.
解决办法是删除这三个文件,重新导入。现在我可以到达断点。
回答by zs2020
Check your Solution Configuration
drop down list. Make sure you select Debug
, not Release
.
检查您的Solution Configuration
下拉列表。确保您选择Debug
,而不是Release
。
回答by Melqui Franco
No meu caso dei um F11 na chamada do método, for?ando entrar no método onde o BP com problema estava, sendo assim, o break point foi recuperado.
没有 meu caso dei um F11 na chamada do método, for?ando entrar no método onde o BP com problema estava, sendo assim, o break point foi recuperado。
In my case I gave an F11 in the method call, forcing to enter the method where the problem BP was, so the break point was recovered.
在我的例子中,我在方法调用中给了一个F11,强制进入问题BP所在的方法,所以断点被恢复了。
回答by DiSaSteR
It is also worth to mention that in some situations the problem occurs, because the project you want to debug is an external service. In that case you have to attach debugger to the running process.
还值得一提的是,在某些情况下会出现问题,因为您要调试的项目是外部服务。在这种情况下,您必须将调试器附加到正在运行的进程。