Visual Studio 2012 ignores symbol locations - debugging

I have disabled "Microsoft Symbol Servers" and added path to .NET 4.5 symbols (W:\Debug\RefSrc\Symbols) that I downloaded from http://referencesource.microsoft.com/.
Unfortunately when I force loading of symbols, for example on mscorlib.dll, Visual Studio ignores this folder and proceeds to download symbol file from symbol server. They end up in W:\Debug\SymbolsCache\MicrosoftPublicSymbols and are exactly identical to those in RefSrc.
Is anyone else seeing this behavior ?
My debug settings:
[ ] Enable Just my code
[ ] Enable .NET framework source stepping
[ ] Enable source server support
I had to disable ".NET framework source stepping" because of this.

don't know how you do it in VS 2012 because I never tried it and now I don't have VS 2012, but the way I do it in VS 2010 is the following:
Debug - from main menu
Options and settings
Debugging -> General
Check Enable .NET Framework Source Stepping and uncheck Enable Just My Code
Go to Debugging -> Symbols
Pick a location for "Cache symbols in this directory"
Check the Microsoft Symbol Servers
Ok
Start your application in Debug mode
Go to Debug menu item and choose Windows->Modules
Press F11 to step into Microsoft .NET Framework code (the one that is public, because from as far as I know not all is)
Hope this helps you a bit. I would disable Enable just my code. Also, if I remember correctly, is possible to select from where to load the symbols when you open the Modules window, by right clicking on the item you want to load the sources for.If the pdb file does not correspond to the binary file, it won't load the symbols if the versions are not the same.

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 into C++ DLL in VS 2013 Express Web

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.

Visual Studio 2012 - View items in the Stack while debugging

I'm using Visual Studio 2012 to write in assembly and I'm currently using the PUSH/POP instructions.
I would like to know where does sit the value being pushed to the stack by the PUSH instruction.
I've tried the Memory Tab by locating the ESP address but didn't find anything there.
Can please someone tell if it is possible and how to reach/locate the pushed values in debugging mode?
Thank you,
Guy
On the topmost toolbar in Visual Studio:
"Debug > Windows > CallStack"
Note that this is only available with the debugger attached to a process.
[Frames below may be incorrect and/or missing, no symbols loaded for
ntdll.dll]
MSDN article: Using the Call Stack.
That error message indicates there are no debug symbols available for the project to use. Make sure that you are in debug mode, not release.
Also if you are using "debug > attach to process" make sure the .pdb (symbol files) are available.
Either:
make sure the .PDB files for your DLLs are in the same directory as the process executable that you are attaching the debugger to.
OR
open Debug > Windows > Modules
Check Symbol Status ("Cannot find or open PDB file" means they aren't loaded)
Locate your DLL
Right click it and
select "Load Symbols From > Symbol Path"

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.

Open source of assertion automatically?

I used to work with VS 2008 but I am missing the following feature in VS 2010 when debugging MFC C++ app:
whenever an assertion occurs, VS 2008 automatically opens the source file and focus the line with an assertion expression
in VS 2010 I have to mark the file name and line of assertion and then manually open the source file and scroll to the expression
Is there some option or registry setting how to enable such behaviour in VS2010 like it works in VS 2008 ?
The first setting that really matters in in the Project + Properties, General page, "Use of MFC". You'll have no trouble if you select the "Use MFC in a static library" setting. This causes the linker to generate the debugger .pdb file entries for MFC symbols, giving the debugger an easy time to find the MFC source code files on your machine.
This isn't always practical however, the "Use MFC in a shared library" setting is the normal one. Which will load the MFC dll from c:\windows\system32, put there when you installed VS. Getting a .pdb for this DLL requires enabling the Microsoft symbol server, Tools + Options, Debugging, Symbols. Press F1 to get config help for this setting page.
You can verify this worked out by using Debug + Windows + Modules while debugging and checking the Symbol File column for mfc100xx.dll. Right-clicking the module and Symbol Load Information provides additional info, showing which directories were searched to find the .pdb
A further complication is that the .pdb that the debugger will download was created on a build server in Redmond which had the source code files installed in f:\dd\vctools\vc7libs\ship\atlmfc. Obviously not the directory where you have them installed. The IDE will prompt you for the actual source code directory. This prompt is often highly confuzzling so clicking Cancel on the dialog is a common thing to do. You now however bought the farm, the IDE remembers that you cancelled this dialog and won't prompt you again. You reset that by deleting the hidden .suo file in the solution directory.

Resources