本文介绍了无法从C#调试非托管的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有写在 C ++ ,并呼吁从 C#应用程序的DLL。在 DLL 是托管代码。

I have a DLL that was written in C++ and called from a C# application. The DLL is unmanaged code.

如果我复制 DLL .PDB 用后生成事件的 C#应用程序的调试执行文件 DIR 我还是不能打任何破发点,我把到 DLL 代码。断点连接到它说,任何符号已加载这个文件的消息。

If I copy the DLL and its .pdb files with a post build event to the C# app's debug execution dir I still can't hit any break points I put into the DLL code. The break point has a message attached to it saying that "no symbols have been loaded for this document".

还有什么我需要做的就是在调试 DLL

What else do I have to do to get the debugging in the dll source?

我有工具 - > 选项 - > 调试 - > 常规 - > 启用只是我的代码为已禁用。
中的 DLL 正与运行跟踪和禁用优化(/ ASSEMBLYDEBUG),并生成调试信息编译成Yes(/ DEBUG)

I have "Tools->Options->Debugging->General->Enable only my code" Disabled.The DLL is being compiled with "Runtime tracking and disable optimizations (/ASSEMBLYDEBUG)" and Generate Debug Info to "Yes (/DEBUG)"

推荐答案

要调试到C ++您需要启用在您的解决方案启动应用程序的混合模式调试DLL。

To debug into your C++ DLL you need to enable mixed mode debugging on the startup application in your solution.


  • 右键单击项目 - >属性

  • 转到调试标签

  • 选中启用非托管代码调试

这将允许您调试到本地代码为F5的风格场景。如果你想启用它连接到这个过程然后做在下面的附加到进程对话框

This will allow you to debug into native code for an F5 style scenario. If you want to enable it for attaching to the process then do the following in the "Attach to Process" Dialog


  • 选择的过程中调试

  • 单击在进程列表上方的选择按钮

  • 单击调试这些代码类型

  • 检查两个托管和本机

  • Select the process to debug
  • Click on the "Select ..." button above the process list
  • Click "Debug these code types"
  • Check both Managed and Native

这篇关于无法从C#调试非托管的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 12:38