Visual Studio and .NET Framework Home
Can't debug unmanaged code from managed project
6/18/2008 2:52:07 AM
User(s) can reproduce this bug
I've created an unmanaged C++ DLL containing C-style functions to be called from a managed project.
Although I've declared everything correctly, the debugger doesn't stop at any breakpoint I've set in the DLL.
Step-In doesn't work as well. The debugger just steps over the calls from my C# project, declared with DllImportAttribute.
This is very frustrating as I can't debug to check whether I've given correct function arguments.
Visual Studio 2008 (All Products and Editions)
Windows Server 2008
Operating System Language
Steps to Reproduce
* Create a C# WinForms application project, add a C++ DLL project.
* Create some C-style functions in the C++ library. (Use DUMPBIN to see that they exist)
* In the C# project, declare the functions using DllImportAttribute
* Set a breakpoint in the DLL.
* Call the so created functions from the C# code.
* Start debugging...
The debugger just steps over the DLL calls and doesn't stop at any of the DLL's breakpoints.
The debugger should step into the DLL code and stop at any given breakpoint.
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 6/18/2008 at 3:56 PM
thanks for trying to help! I've got the right tip from the newsgroups. I added it to the comments section above.
on 6/18/2008 at 3:55 PM
Got a helpful reply from the newsgroup:
"Go to Debugging category in the project settings and enable both native and managed code debugging."
Unfortunately I can't close this issue myself.
on 6/18/2008 at 11:26 AM
Try setting the DLL project as the startup project (right-click on the dll project -> set as startup project). You must copy the C# executable to the dll output directory. Hit F5 and point to the copied executable. This is how I do it. It's more like a workaround, so let's hope they (can) fix it.
to post a workaround.
Please enter a workaround.
on 6/18/2008 at 3:52 PM
Go to Debugging category in the project settings and enable both native and managed code debugging.
© 2014 Microsoft