My problem is basically that whenever I debug using Visual Studio (2015 Community edition on Windows 10 machine), and I try to hover over a variable or look at a variable in the locals or autos section of the debug view, I don't see the actual data saved in the variable.
This is a problem I have seen with both strings and vectors. For strings, it will show npos=4294967295
and if you keep clicking the drop down arrows, you will eventually get to the actual string saved in that variable; only after digging into the internal structure of the variable, like std::_String_alloc
and _Mypair
and _Myval
, etc. Same for vectors.
Has anyone ever experienced this problem or knows how to fix it?
I had the same problem. I assume you are debugging an unmanaged (native) C++ DLL that is part of a solution that uses a managed EXE? In my case I have a C# WPF EXE which PInvokes functions in an unmanaged C++ DLL.
"Fixes" that worked in my case:
FIX 1: Uncheck "Use managed compatibility mode" in the debugger settings: You can do this at Tools/Options/Debugging/General. See: https://stackoverflow.com/a/33462362/5556801 For some discussion of what "managed compatibility mode" is, and why you normally want it unchecked, see: http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013.aspx
"FIX" 2: As a partial work-around you can first start your process without the debugger (Ctrl+F5), then attach the VS2015 debugger to your process (Debug / Attach-to-Process), but only select "Native code" with the "Attach to / Select..." button. Now when a breakpoint in your native C++ DLL is hit you can hover over std::string variables and VS2015 will show their full contents as expected, including their data members. The disadvantage of this native-code-only work-around is that you won't be able to debug your managed code (e.g. C# or CppCli) at the same time.
In project properties select Debugging->Debugger Type->Native Only. In my case it was Mixed
Uncheck Debug->options->use native compatibility mode
I got this working great after trying all the above answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With