Maya Array C++ Visual Studio Debugger Visualizations that aren't terrible

When debugging Maya C++ arrays in Visual Studio, the information it shows is basically useless. You just get to see the a couple pointer addresses, and the first item in the array, and nothing else. Not even the length of the array. So I got fed up with it, and went looking for how to display them in a sane way.
I’ve looked this up before and found nothing… But for whatever reason, this time I found something. So I’ve made a quick-n-dirty file, and decided to share it with you all.
Basically, you can just do this using a specially formatted XML file.

I’ve linked to a gist of Maya2020.natvis. And you can just drop it into %USERPROFILE%\Documents\Visual Studio 2022\Visualizers (obviously, change the path to whatever version of VS you’re using).

Unfortunately, the type has to be fully qualified with all of its namespaces, so if you wanted to use this for a different maya version, you’d need to change the OpenMaya20200000 parts to the namespace of whatever version of Maya you’re debugging.

I’m also looking into MStrings … but it looks like they’re much more complicated because they include localization, unicode, and stack allocation for short strings.

2 Likes