2022-07-27 MS debugger visualizer Tags: msvc natvisHow to capture and use the template parameters in custom debugger visualizers. #### Couple of caveats: Capture multiple template parameters (not in the [docs](https://docs.microsoft.com/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2022#templated-classes)), e.g.: ``` <Type Name="MyType<*,*,*>"> ``` Then refer to these as `$T1`, `$T2` and `$T3`, however, inside a `DisplayString` you have to use `{"$T1"}` instead. This prints extra quotes around the string, which you can get rid of by adding a format specifier ([docs](https://docs.microsoft.com/en-us/visualstudio/debugger/format-specifiers-in-cpp?view=vs-2022#BKMK_Visual_Studio_2012_format_specifiers)): ``` {"$T1", sb} ``` To compare the name of a parameter type in a `Condition` one has to use the `strcmp` function: ``` Condition='strcmp("$T1","char")==0' ``` `DisplayString` can also include a `Condition`. Attached example adapted from: [https://github.com/hhoppe/Mesh-processing-library/blob/main/libHh/libHh.natvis](https://github.com/hhoppe/Mesh-processing-library/blob/aade85891a0fd02c9f74f01225cbfb1b6e77b44e/libHh/libHh.natvis)