Debugging into C++ DLL in VS 2013 Express Web - visual-studio

I'm developing a C# MVC project in Visual Studio 2013 Express for Web. An external C++ DLL is imported into the project and a function which is exported from the DLL is consumed.
I would like to be able to debug into the C++ DLL. However at the moment when I try to step into the function call the debugger steps over instead. The C++ DLL is one I created myself in Visual Studio 2013 Express for Windows Desktop. I have generated the .pdb debug symbols for the DLL and they are in the same folder as the DLL.
I have read in similar posts that suggest perhaps there is a properties setting to enable debugging into external an DLL. However in the MVC 5 project properties I can't find this option. In fact there doesn't even appear to be a debugging tab.
Is debugging into an external C++ DLL possible in Visual Studio 2013 Express for Web? If it is how do I enable this feature? If it is not possible, is there another Visual Studio Express where this is possible?
Thanks for your help!

I don't have VS Express, but the following applies to VS Professional and should apply to Express as well. You need to set your Debugger Type to Native Only (best, but then you have to break in the native code to debug it) or Mixed (may or may not work, I don't use it, so not sure it's limitations), and make sure the DLL is freshly build and matches the source code you have available. I suspect the setting you refer to is called 'Just My Code' (in Options->Debugging), but I don't think it matters in this case.

I'm not sure about VS2013 but with VS2015 you need to set "Enable Native Code Debugging". Right click on your C# project. In the right pane, click Debug. Under Enable Debuggers click the check box on Enable Native Code Debugging.

Related

On Visual Studio 2019, how to debug pure C++ and CLI C++ in a C++ Debug program?

I want to debug a C++ MFC/CLI program developped on Visual Studio 2019.
Until now, I can debug C++ native (MFC) code.
DebugType in Debug panel is set to Auto.
All breakpoints in C++/CLI modules are flagged as inactive (a red circle with an interrogation character in a yellow triangle).
After having changed DebugType from Auto to 'Mixed (.Net Framework), Visual Studio, when starting a debug session, is displaying following warning box.
But my build is in DEBUG mode !
What is happening ?
What must I do to debug pure C++ AND CLI C++ code ?
PS: I have also tried to debug in only C++/CLI code, but Visual Studio 2019 is displaying same message !
On Visual Studio 2019, how to debug pure C++ and CLI C++ in a C++
Debug program?
Since I do not have your project and cannot troubleshoot the issue quickly unless you provide a sample.
You can try the following suggestions:
Suggestions
1) try to reset all settings by Tools-->Import and Export Settings-->Reset All Settings
2) disable any third party extensions under Extensions-->Manage Extensions in case one of them causes the behavior.
3) check Use Managed Compatibility Mode option, Enable .NET Framework source stepping option and Suppress JIT optimization on module load (Managed only) option under Tools-->Options-->Debugging-->General.
4) close VS, delete .vs hidden folder, Debug folder from the solution folder and also Debug folder in the project folder. Then restart your project to test again.
I'm putting this here because it might help someone in the future, and because it's completely nuts.
I've followed all instructions I could find, including the ones on this question, reinstalled VS twice, with different versions, and nothing.
What solved for me was to simply delete the lines of code and write them again.
Yes.
I know.

Debugging VB6 Code From Visual Studio 2012

We have a .NET application using a lot of legacy components written in VB6. We were able to debug the VB6 code using native code debugger and generated pdb files in Visual Studio 2010. After upgrading to the VS 2012 (including Update 2) we cannot do this.
The module window shows following message:
Binary was not built with debug information.
You can also find following message in the output window:
Module was built without symbols.
When I try to load symbols manually, I get following message:
A matching symbol file was not found in this folder.
Debugging the very same dll or exe from VS 2010 works fine.
Is there any option to enable it?
I found a solution that works on my machine (per Microsoft's comments on ScottG's paid support request - thanks, Scott). Apparently Visual Studio's default debugger after 2010 doesn't handle VB6 DLLs, but there's a checkbox to use the old debug engine, which does:
I didn't need to enable Native Edit and Continue.
I have finally found how to enable debugging VB6 components using Visual Studio 2012. In short, you have to enable the old pdb format first by setting Options | Debugging | Edit and Continue | Enable native Edit and Continue and then you can attach to the dllhost.exe as usually.
In VS 2015 Tools->Options->Debugging->General, select 'Use Native Compatibility Mode'. It sucks that I still need to debug VB6, but I am thankful that I am still able to.
it seems that VS 2012 use msdia110.dll to decode symbol files, there's a DIA SDK sample in VS folder, you can test whether it can parse those VB pdb files. if it can't, i guess the new version DIA does not support old version pdb any more.

Visual Studio 2010 Pro, Prevent Debugging 3rd Party Controls

I want to prevent VS from attempting to debug code that is not mine. When I 'Step-Into' my code, VS tries to find resource files I don't have. I'm really not interested in viewing the 3rd party code code.
How can I only step through my managed code?
Followed this without success:
Restrict Visual Studio 2010 from debugging third-party DLL files
Also changed JIT debugging to Managed only.
Using breakpoints and step over.

Issues debugging Moles

I’m using visual studio 2008 and moles version 0.93. Everything works well except when I try to debug any test that uses a Moled type. The test skips all my breakpoints. And I get the following message in the output window:
Unable to attach. Check for one of the following.
The application you are trying to debug uses a version of the Microsoft .NET Framework that is not supported by the debugger.
The debugger has made an incorrect assumption about the Microsoft .NET Framework version your application is going to use.
The Microsoft .NET Framework version specified by you for debugging is incorrect
Please see the Visual Studio .NET debugger documentation for correctly specifying the Microsoft .NET Framework version your application is going to use for debugging.
If I try debbuger.Break () I get a message: "No symbols are loaded for any call stack frame. The source code cannot be displayed."
I’m in a crunch right now chasing an issue with one our main components and it has been a pain (like I need novocaine) trying to figure anything out without being able to step through the code.
I want to take advantage of mole's "smooth debugging experience". However, I can't seem to get the debugger to attach at all.
Thanks,
Bzz
See the solution to this issue here:
http://social.msdn.microsoft.com/Forums/en/pex/thread/91c08bf4-3260-458c-a221-91f030a75499
I had this problem when I moved a project from Visual Studio 2010 to Visual Studio 2008. Here's what I did to fix it.
Close Visual Studio. Navigate to the Debug/bin location. Delete the following files:
*.vshost.exe
*.vshost.exe.config
*.vshost.exe.manifest
Open the solution. Goto the project Settings. Under the Application Target Framework, select a framework lower than the one you are working with (you'll set it back later). Visual Studio will close and re-open your project automatically. Then set the Target Framework back to the original version you were working with. Rebuild all, and debugging will work properly.

No IntelliSense for C++/CLI in Visual Studio 2010?

I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major flaw:
When I try to use AutoComplete in a C++ source file for managed C++, a small note in the footer appears:
IntelliSense for C++/CLI is not available
Uh, has IntelliSense for C++/CLI been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful...
You are correct. Unfortunately it has been dropped. You can check this opened issue on Microsoft's Connect website.
I'll just quote them for the sake of the answer:
Unfortunately in this release we had to cut the intellisense support for C++/CLI due to time constraints. If you want to get some intellisense like quick info and memberlist on the native classes you can get it by choosing no /clr support in the project properties.
About getting back intellisense, your best chances for now are using third-party tools like VA Assist for example. I've tried it with Visual Studio 2008 and its IntelliSense is a whole lot better than the default one.
It is available again in Visual Studio 2012.
If you want to get IntelliSense back, install Visual Assist X from Whole Tomato Software. Here you can get a 30-days trial to check the intellisense.
According to the Visual C++ Team Blog, C++/CLI Intellisense will be in the next version of Visual Studio, but not in a service pack for VS2010. That blog post also gives some detail as to what went wrong and led to this sad state.
I don't know if you can use this settings but it work for me. I only check the Common Language RunTime Support for the cpp files that use it. I do not check it for the whole project and I've got intellisense for all the files that don't use the CLI.
Yes! you can enable the IntelliSence, but in a tricky way. Follow these instructions:
Go to your project properties. (Right click on your project name in
Project Explorer, and select Properties. or simply Alt + Enter)
From Configuration Properties, select General
In the right-hand section, find "Common Language Runtime Support"
and change it to "No Common Language Runtime Support".
Click the OK Button.
Now the IntelliSence is working. But a problem is an error when you compile your code! (The error is: error LNK1123: failure during conversion to COFF: file invalid or corrupt)
You can simply go back to Project Properties an change Common Language Runtime Support to "Common Language Runtime Support, Old Syntax (/clr:oldSyntax)".
Good luck.
This solution is only if you don't want Common Language Runtime
It worked for me in VS2010
Go to Project Propreties > Configuration Properties > General > Common Language Runtime Support and set it to No Common Language Runtime Support.
This will work fine just after hitting Apply button.
As mentioned you could install some paid software such as "Visual Assist X from Whole Tomato Software".
or
You could use open source tools that contain intellisense*, one such tool is Qt Creator 3.3.1 (opensource). You have two options, either setup your entire project with Qt to compile using VS2010 compiler, or use Qt to link to your source files and compile with VS2010. You write your code in Qt, save, flip windows to vs2010 and compile and debug.
When changes are saved in Qt, vs2010 will automatically reload the source file in the project and you can compile.

Resources