Possible workaround for Visual Studio 2012/2013 debugger not displaying std :: string values

I also posted this on the MSDN forum here: MSDN forum post

When using the / clr option with a Visual Studio C ++ project, the debug renderer for std :: string and other types doesn't seem to work. Here are the steps:

  • Running VS2012 or 2013
  • Creating a New Visual C ++ / Win32 Console Application
  • In your main .CPP file add: #include <string>

  • In the main method add: std::string s = "abc";

  • Debugging the program and checking the 's' variable. Notice how it shows the string "abc". This is what we want.
  • Open project properties / General. Set "Common Language Runtime Support" = "Common Language Runtime Support (/ clr)"
  • Debugging the program and checking the 's' variable. Now the string "abc" is not displayed.

Additional Information:

I can see the definitions of the debug renderer for std :: basic_string in both autoexp.dat and stl.natvis files for Visual Studio. However, this seems to be ignored when using / clr. One way to confirm that he actually ignores these definitions is to add additional text to them. When / clr is not used, VS shows the text in preview mode; with / clr on, it is not.

There are other similar streams such as:

However, all of these streams seem to indicate that the autoexp.dat and / or natvis files are in use and subject to change. In my case, I find that these files are completely ignored when using / clr.

Does anyone know about work?

+3


source to share





All Articles