I tested in VS2022 17.4 with compiler VS2010 and I reproduced the issue. But I find std::string
is an type of class in c++.It does return a class type data structure when debugging with old compiler toolset VS2010 in Local window. Expand the str
and you will see the value test
in _Buf
in the char* type data structure. You can add str. c_str()
in watch window and you’ll see it shows the value in char* type.
c_str returns a const char* that points to a null-terminated string (i.e., a C-style string)

I guess the reason of the difference in showing string type variable value in debug mode between two compiles is depending on compiler.
If you want it to show variable values on hover with VS2010 compiler, here’s a workaround to achieve it.
const char* str = "test";
char str[] = "test";