microsoft / ConcordExtensibilitySamples

Visual Studio Debug Engine Extensibility Samples
Other
121 stars 50 forks source link

How can I add a new struct and use different Visualizer to show up it and FILETIME? #82

Open falling-light opened 2 years ago

falling-light commented 2 years ago

I have runned CppCustomVisualizer successfully and added a struct(named StructTest),I can add function in _EntryPoint.cpp to show up text I declared. But now I have some problems: FILETIME also changed and I don’t know how to distinguish it from my struct. image Now I want to show date and time when the struct Is FILETIME and show text I declared when the struct is StructTest. How can I do this?

gregg-miskelly commented 2 years ago

I don't quite understand what you are trying to do -- are you trying to still customize FILETIME as an example of a second type? Or are you not actually trying to still customize FILETIME?

What does your .natvis file look like?

falling-light commented 2 years ago

I actually want to customize a new struct and using different Visualizer to show up it and FILETIME. (still customize FILETIME as an example of a second type),showing up like this:If the struct is FILETIME,it shows date and time,and if the struct is StructTest it shows the text I declared.(like the two pictures below) image image My code:

//CppCustomVisualizer.natvis
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

  <Type Name="_FILETIME">
    <!--NOTE: The 'VisualizerId' is also specified in the .vsdconfigxml to control which
    implementation of IDkmCustomVisualizer is used.-->
    <CustomVisualizer VisualizerId="8E723FD7-611E-40E7-98C0-624D8873F559"/>
  </Type>
  <Type Name="StructTest">
        <!--NOTE: The 'VisualizerId' is also specified in the .vsdconfigxml to control which
    implementation of IDkmCustomVisualizer is used.-->
     <CustomVisualizer VisualizerId="9439073C-F56C-46B6-86FA-0F6BD55BDD2A"/>
   </Type>
</AutoVisualizer>
//CppCustomVisualizer.vsdconfigxml
  <NativeComponent
    ComponentId="{184B8704-E76C-454A-991F-351D9AB15CFC}"
    ComponentLevel="9991500"
    ModuleName="CppCustomVisualizer.dll">
    <!--NOTE: For more information on ComponentLevel, see https://github.com/Microsoft/ConcordExtensibilitySamples/wiki/Component-Levels -->

    <Class Name="CCppCustomVisualizerService" ClassId="{9535F50E-1738-4AE2-8507-5207C44B8261}" WorkerProcessSupported="true">

      <Implements>
        <InterfaceGroup>
          <Filter>
            <!--NOTE: This VisualizerId is also used in the .natvis file.-->
            <VisualizerId RequiredValue="8E723FD7-611E-40E7-98C0-624D8873F559"/>
        <VisualizerId RequiredValue="9439073C-F56C-46B6-86FA-0F6BD55BDD2A"/>
          </Filter>
          <Interface Name="IDkmCustomVisualizer"/>
        </InterfaceGroup>
      </Implements>
    </Class>

  </NativeComponent>
</Configuration>