如何安装调试器步入机(C ++)的代码从托管(C#)包装? [英] How to attach debugger to step into native (C++) code from a managed (C#) wrapper?

查看:119
本文介绍了如何安装调试器步入机(C ++)的代码从托管(C#)包装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我身边有一个C ++函数调用这是我从C#代码调用的包装。我如何在Visual Studio调试器附加步入本地C ++代码

I have a wrapper around a C++ function call which I call from C# code. How do I attach a debugger in Visual Studio to step into the native C++ code?

这是我有包装它调用的GetData()在C ++中定义的文件?

This is the wrapper that I have which calls GetData() defined in a C++ file:

    [DllImport("Unmanaged.dll", CallingConvention=CallingConvention.Cdecl, 
               EntryPoint = "GetData", BestFitMapping = false)]
        public static extern String GetData(String url);



中的代码崩溃,我想探讨的根本原因。

The code is crashing and I want to investigate the root cause.

谢谢,
尼基尔

Thanks, Nikhil

推荐答案

检查项目的属性页面上的调试选项卡。应该有一个启用非托管代码调试复选框。这为我工作,当我们开发了一种新的.NET UI为我们的旧的C ++动态链接库。

Check the Debug tab on your project's properties page. There should be an "Enable unmanaged code debugging" checkbox. This worked for me when we developed a new .NET UI for our old c++ DLLs.

如果您的非托管的DLL正在从另一个项目建成(一会儿我们正在使用VS​​6)只要确保你有DLL的PDB文件方便的调试构建的。

If your unmanaged DLL is being built from another project (for a while ours were being built using VS6) just make sure you have the DLL's pdb file handy for the debugging.

另一种方法是使用C#exe文件作为目标exe文件,从运行DLL项目,然后你可以调试你的DLL正常。

The other approach is to use the C# exe as the target exe to run from the DLL project, you can then debug your DLL normally.

这篇关于如何安装调试器步入机(C ++)的代码从托管(C#)包装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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