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?
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
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.
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.
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.