microsoft/MIEngine

Natvis support for VSCode

graghavan007 opened this issue · 2 comments

Is MIEngine support for VSCode identical to MIEngine support for Visual Studio ?
Maybe my terminology is wrong. Are all Natvis schema objects supported by Visual Studio, also supported by VSCode ?
thanks
gopal

The VS Code MIEngine and Visual Studio MIEngine are the same and use the same natvis reader.

The Visual Studio MIEngine scenarios are Linux C++ Projects, Open Folder Debugging with launch.vs.json using cppdbg, or SSH Attach.

For VS Code, this is where the launch.json has type: cppdbg.

If you are talking about the Windows C++ Debugging scenario, it uses a different natvis reader.

See https://code.visualstudio.com/docs/cpp/natvis

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:
image
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