在调试托管代码的同时调试非托管代码 [英] Debugging unmanaged code while debugging managed code

查看:22
本文介绍了在调试托管代码的同时调试非托管代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的 .NET 3.5 应用程序由一堆不同的解决方案组成.其中一些解决方案包含托管代码 (C#),其他解决方案包含非托管代码 (C++).用 C# 编写的方法与用 C++ 编写的方法通信.我试图追踪这些不同函数之间的依赖关系,我想在包含我的 C++ 函数的解决方案上设置断点.C# 解决方案之一具有启动项目.我在调试模式下运行这个解决方案,期望我的非托管代码中的断点会被命中,但实际上什么也没发生.有人可以指导我完成使用 Visual Studio IDE 调试混合应用程序的过程吗?

The .NET 3.5 application I am working on consists of bunch of different solutions. Some of these solutions consist of managed code(C#) and others have unmanaged code(C++). Methods written in C# communicate with the ones written in C++. I am trying to trace the dependencies between these various functions and I thought setting breakpoints on the solution consisting my C++ functions. One of the C# solutions have the startup project. I run this solution in debug mode with the expectation that the breakpoints in my unmanaged code will be hit but nothing really happens. Can somebody guide me through the process of debugging mixed applications such as these using the Visual Studio IDE?

谢谢

推荐答案

默认情况下,托管项目将仅在启用托管调试的情况下启动调试器.它不考虑在同一解决方案中存在非托管项目.为了调试两者,您需要显式启用非托管代码调试.

By default a managed project will only start the debugger with managed debugging enabled. It doesn't consider that there are unmanaged projects in the same solution. In order to debug both you need to explicitly enable unmanaged code debugging.

  • 右键单击项目并选择属性
  • 转到调试"选项卡
  • 勾选启用非托管代码调试"

这篇关于在调试托管代码的同时调试非托管代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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