简体   繁体   English

调试混合模式应用程序(C#和非托管C ++)时出现“当前不会遇到断点”错误

[英]“The breakpoint will not currently be hit” error while debugging a mixed mode application (c# and unmanaged c++)

While debugging a mixed mode application in VS2010, the breakpoint set on a line of code contained in an unmanaged c++ dll source file (called from a managed c# wrapper class) shows the infamous "The breakpoint will not currently be hit. No symbols have been loaded for this document" info message when hovering the mouse over the breakpoint on the line in question. 在VS2010中调试混合模式应用程序时,在非托管c ++ dll源文件(从托管c#包装器类调用)中包含的代码行上设置的断点显示了臭名昭著的“该断点当前不会被命中。没有符号已被使用。将鼠标悬停在相关行的断点上时,将显示“为此文档加载”信息消息。 The breakpoint itself is a red circle with a yellow info triangle instead of the usual solid red orb. 断点本身是带有黄色信息三角形的红色圆圈,而不是通常的实心红色球体。 Of course, the breakpoint isn't hit when the debugger is executed. 当然,执行调试器时不会遇到断点。 Most answers I've found for this warning indicate the breakpoint hasn't been set properly, or that the expected dll is not being loaded, or that the associated pdb file is not located in the correct location, etc. etc. This is not the problem. 我针对此警告找到的大多数答案都表明未正确设置断点,或者未加载预期的dll,或者关联的pdb文件未位于正确的位置,等等。等等。这不是问题。 The application does load and execute the referenced dll correctly. 该应用程序确实加载并正确执行了引用的dll。 I've verified that the correct pdb file, with the same file date as its dll, is located in the executable's working directory along with the target dll itself. 我已经验证了正确的pdb文件(与文件的dll具有相同的文件日期)与目标dll本身一起位于可执行文件的工作目录中。 The debugger simply doesn't load the symbols for the dll, and the dll doesn't show in the Modules list. 调试器根本不会加载dll的符号,并且dll不会显示在“模块”列表中。

None of the solutions I've found online work for this problem. 我没有找到可以解决此问题的在线解决方案。 The dll doesn't show in the modules list available from 'Debug->Windows->Modules' menu selection... even though it is, in fact, loaded. 该dll不会显示在'Debug-> Windows-> Modules'菜单选择中的可用模块列表中,即使它实际上已被加载。 Breakpoints set in the wrapper class work correctly. 包装器类中设置的断点可以正常工作。

Deleting the bin and obj directories, cleaning and rebuilding the solution also doesn't help. 删除bin和obj目录,清理和重建解决方案也无济于事。

解决此问题的方法是设置应用程序属性页的“调试”选项卡中的“启用非托管代码调试”标志

You aren't hitting the code, and aren't having the dll show up in your modules list, because it's not being loaded by the program. 您没有点击代码,也没有在模块列表中显示该dll,因为该程序未在加载该dll。 So whatever your C# wrapper is calling, it's not that - or maybe that's not getting called correctly. 因此,无论您的C#包装程序正在调用什么,不是那样-或可能是无法正确调用。

It's a little unclear as to what your error is, but if you are getting the message that says "the breakpoint will not currently be hit", it means exactly what it says - you are not hitting a breakpoint you set. 目前尚不清楚您的错误是什么,但是如果您收到提示“当前不会命中断点”的消息,则表示其含义完全相同-您未达到所设置的断点。 Try looking back in you program and see where the breakpoints are (they should be red dots in the margin), then see if you are actually getting to them 尝试在程序中回顾一下,看看断点在哪里(它们应该在边距处是红点),然后查看您是否真正到达了断点

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

相关问题 调试混合模式(C#,C ++)应用程序 - Debugging Mixed mode (C# , C++) application 混合模式调试(C++、C#、VB) - Debugging in mixed-mode (C++, C#, VB) C# Visual Studio 服务调试“当前不会命中断点。没有为此文档加载任何符号” - C# Visual Studio Service Debugging "The breakpoint will not currently be hit. No Symbols have been loaded for this document" 混合C#,托管C ++和非托管C ++应用程序的日志记录框架 - Logging framework for mixed C#, managed C++, and unmanaged C++ application Visual Studio C#调试器 - 当前不会遇到断点 - Visual Studio C# debugger - the breakpoint will not currently be hit 使用本机 C++、托管 C++ cli 和 C# 解决方案在混合模式下调试 - debugging in mixed mode with native C++, managed c++ cli, and c# solution 调试 Azure IoT Edge 模块 C#(如何下断点) - Debugging Azure IoT Edge Module C# (how to hit a breakpoint) 在C#中调试时,FileSystemWatcher没有达到断点 - FileSystemWatcher is not hitting the breakpoint while debugging in C# 断点当前不会被命中 - 远程调试 - The breakpoint will not currently be hit - Remote Debugging C# 断点命中调试器 - C# Breakpoint hit the debugger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM