Different results on vscode and visual studio
graghavan007 opened this issue · 3 comments
I wrote the following code :
class MyClass {
public:
int myNum = 11;
std::string myString="hello";
};
Instantiated the class as: MyClass c = MyClass();
Here is my Natvis file:
<Type Name="MyClass">
<DisplayString>"Hello</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="ind" InitialValue="-1" />
<Size>10</Size>
<Loop>
<Break Condition="ind == 5" />
<Exec>ind += 1</Exec>
<Item>ind,na</Item>
</Loop>
</CustomListItems>
</Expand>
</Type>
When I run this on Visual Studio/Windows I get:
a list of items [0]-[5] with values of 0-5 as expected
When I run this on VSCode/Linux/gdb, I get nothing. Only the Raw View.
We are not using the debugger to get any values from the program, so I would have expected the same output in both cases ?
What is the difference ?
Thanks much
Originally posted by @graghavan007 in #1094 (comment)
When I run this on Visual Studio/Windows I get:
What kind of project do you have here? The default Windows C++ project uses a different natvis reader than MIEngine.
I believe MIEngine does not support Loop
.
To use MIEngine in Visual Studio, you will need to create a project for WSL or use SSH for a Linux Project.
Ok. I was confused because in item #1094, you had mentioned:
The VS Code MIEngine and Visual Studio MIEngine are the same and use the same natvis reader.
and i missed the subtlety that windows c+= uses a different natvis reader not MIEngine.
I am using VS Code on Linux so the two options don't apply to me.
Thanks for your help.
Ah sorry, I should have emphasized Visual Studio MIEngine
.
MIEngine is used for the "Linux" scenarios for Visual Studio. This includes using MinGW/Cygwin on Windows, but not projects built for VC++ that use vcxprojs.