Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CppCustomVisualizer doesn't install in VS2019 #52

Closed
pps83 opened this issue Dec 26, 2019 · 9 comments · Fixed by #53
Closed

CppCustomVisualizer doesn't install in VS2019 #52

pps83 opened this issue Dec 26, 2019 · 9 comments · Fixed by #53
Assignees

Comments

@pps83
Copy link

pps83 commented Dec 26, 2019

If you build it, resulting CppCustomVisualizer.vsix doesn't install in vs2019.
Also, there seem to be x64 versions, but .vsix doesn't build with x64 version.

@maxruben
Copy link

maxruben commented Dec 26, 2019

Change the source.extension.vsixmanifest file to this and it will install in visual studio professional 2019:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
  <Metadata>
    <Identity Id="8F12C6F5-BE35-4DDD-B452-44811F0A3A4D" Version="1.0" Language="en-US" Publisher="Sample" />
    <DisplayName>CppCustomVisualizer Debugger Sample</DisplayName>
    <Description xml:space="preserve">CppCustomVisualizer Debugger Sample</Description>
  </Metadata>
  <Installation InstalledByMsi="false">
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0, 17.0)" />
  </Installation>
  <Prerequisites>
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
  </Prerequisites>
  <Assets>
    <Asset Type="DebuggerEngineExtension" Path="CppCustomVisualizer.vsdconfig" d:Source="File" />
    <Asset Type="NativeVisualizer" Path="CppCustomVisualizer.natvis"  />
  </Assets>
</PackageManifest>

/Ruben

Edit; It seems like formatting of the xml code isn't preserved properly in the editor.

@pps83
Copy link
Author

pps83 commented Dec 26, 2019

use 3 backticks to paste as-is

@gregg-miskelly
Copy link
Member

Also, there seem to be x64 versions, but .vsix doesn't build with x64 version.

The x86 solution configuration will build the custom visualizer project for both x86 and x64 and include both in the VSIX. See step 2 from here.

@pps83
Copy link
Author

pps83 commented Dec 26, 2019

Also, there seem to be x64 versions, but .vsix doesn't build with x64 version.

The x86 solution configuration will build the custom visualizer project for both x86 and x64 and include both in the VSIX. See step 2 from here.

Thanks, I've figured it out after I posted it here (and how to make it run on vs2019)

@pps83
Copy link
Author

pps83 commented Dec 27, 2019

I wanted to write my own visualizer and the only place to start is CppCustomVisualizer, I wasn't able to find anything else. In hopes to make it better I'll share my experience/feedback:

  • I recall with old visualizers (in vs2005-2008 era) it was easier to debug them, as I was able to build and run it in the same project without installing vs extension. Now it's unnecessarily complicated as I had to uninstall/install (and quit VS each time) and I wasn't even able to debug visualizer itself.
  • I started with the sample and had to search/replace to rename it. It's not clear where and which GUIDs I'd need to change to make it different (according to VS) from CppCustomVisualizer. At first VS refused to install it (as I didn't update GUIDs), and then when I updated them, it simply didn't work (perhaps I changed too many GUIDs). So, I simply settled on using the same code as CppCustomVisualizer itself. Sample should list what guilds need to be changed and where.

@maxruben
Copy link

The good thing about the CppCustomVisualizer sample is that it actually starts a new Visual Studio instance with the TargetApp and the visualizer dll installed via the .vsix (startup) project when running a debug session on the CppCustomVisualizer project. When starting the debugger for the TargetApp, you can set breakpoints in the dll code in the other Visual Studio instance to see whats happening. No need to keep installing and uninstalling the .vsix file. Just close down the debugging for the TargetApp and the Visualizer dll will be installed from fresh in the next debugging session. Very nice.

I would like to have some more insight in how you would go about to do custom visualizers for more than one type/class in the same dll.

/Ruben

@gregg-miskelly
Copy link
Member

@pps83 as maxruben mentioned, you shouldn't need to install/uninstall a .vsix for normal development-time debugging. The VSIX project's build will take care of 'installing' the vsix into the 'experimental instance' of VS. In case you didn't see them, there are instructions here.

@pps83
Copy link
Author

pps83 commented Jan 5, 2020

@gregg-miskelly I tried to follow Running the Sample in Visual Studio but it doesn't work. When I hit F5, I get a new vs2019 started but it doesn't load TargetApp.sln and offers me to open a project. If I open TargetApp.sln manually and try to debug, I don't get visualizers working for FILETIME.

Also, as @maxruben mentioned, it's not clear how to make visualizers that work for multiple types. That should be explained/shown in the example.

@gregg-miskelly
Copy link
Member

gregg-miskelly commented Jan 8, 2020

@pps83 For the issue of F5'ing not working, can you open a new issue? Please include:

  • What version of VS you are using
  • Did you clone the repo to a path with a space?
  • A screen capture of your Visual Studio with solution explorer up, and the 'Debugging' property page of the .vsix project showing (see example below)

For the second question (multiple types): There are probably many different answers depending on how separate you want your implementations to be, but in the most simple case, just add the additional type to your natvis. You should be able to either reuse the same VisualizerId, or declare a new one. If you decide to declare a new one, you could either declare multiple classes (one for each VisualizerId) or you could have one class that handles them all. In the later case, your .vsdconfigxml would look like this:

<Implements>
        <InterfaceGroup>
          <Filter>
             <!-- Example of supporting three different visualizers. -->
            <VisualizerId RequiredValue="D3C901B3-8005-435E-803D-DF43E6C3ED29"/>
            <VisualizerId RequiredValue="748F6A19-A624-4026-A39C-8019532B586E"/>
            <VisualizerId RequiredValue="D6DFE1A0-4A83-4BAC-B3BB-0FB8BF9149DA"/>
          </Filter>
          <Interface Name="IDkmCustomVisualizer"/>
        </InterfaceGroup>
      </Implements>

Example screen capture:
vsix-launch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants