microsoft / VSExtensibility

A repo for upcoming changes to extensibility in Visual Studio, the new extensibility model, and language server protocol.
MIT License
370 stars 48 forks source link

The View button is no longer shown on custom debug visualizers #417

Closed ThomasArdal closed 1 month ago

ThomasArdal commented 1 month ago

I have developed a few Debugger visualizer packages using the new approach with DebuggerVisualizerProvider and VisualStudioContribution as seen here: https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/debugger-visualizer/debugger-visualizers?view=vs-2022. One visualizer that I already have on the Marketplace is here: https://github.com/elmahio/ExceptionVisualizer. I noticed in recent versions of Visual Studio 2022, my debug visualizer no longer shows up. I don't know exactly which minor version did this, but it worked back when I first published that extension.

I think I read somewhere that the new debug visualizer cannot be distributed as Vsixs on the marketplace. But it was working fine back then to add a new class library and include a source.extension.vsixmanifest file. The project type needed a special Sdk like this:

<Project Sdk="Microsoft.VisualStudio.Sdk.Build/17.5.4065">

When installing the visualizer linked above from the Marketplace, the visualizer no longer shows up during debugging. What could be the cause and is there any fix for distributing visualizer through the marketplace? If not, how do other people install them?

Missing "View" button seen here:

visualizers

In the previous version of VS, both the target and ex variables would show the "View" button from those two extensions.

Tested in both 17.11.2 and 17.12.0 Preview 1.0.

ThomasArdal commented 1 month ago

BTW, I just tried upgrading to VisualStudio.Extensibility version 17.11.40261 released today. It doesn't work either. When debugging the extension from Visual Studio with an experimental instance works fine. But after installing the built vsix, no debug visualizer "View" button is shown like when debugging.

mpeyrotc commented 1 month ago

Hello Thomas, I believe you might be mixing the legacy visualizer extension docs with the newer ones described here: https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/debugger-visualizer/debugger-visualizers?view=vs-2022

You do not need a separate .vsix project anymore since that one will install it in a different path from where out-of-process visualizers are supposed to be installed now. That is why the Visualizer Infrastructure fails to detect your extension and that is why it doesn't show up.

ThomasArdal commented 1 month ago

The URL you provided is the same one I included in the original description. I know that I can just F5 the project to launch the visualizer in an experimental instance of VS. That part works fine. But, if I cannot embed this in a VSIX installable from the Marketplace (which worked previously) how can I distribute the visualizer to people? Thanks

mpeyrotc commented 1 month ago

Yes, that is what I meant. Your project does not follow the recommended structure and your generated .vsixmanifest is not classifying your extension as an out-of-process VisualStudio.Extensibility extension. Our recommendation is to reorganize your project as shown in this sample. The project should output the .vsix package that you can distribute as normal, no other changes required.

ThomasArdal commented 1 month ago

Aaah ok. I wasn't aware that the output directory contained the .vsix. But it does and that one works fine.

Do you plan on adding some documentation (or maybe I just couldn't find it) on how to modify the generated .vsixmanifest? I know that some of the meta data can be configured like this:

Metadata = new(
    id: "...",
    version: this.ExtensionAssemblyVersion,
    publisherName: "...",
    displayName: "...",
    description: "..."),

But, meta data doesn't seem to include icon, tags, etc.

sboulema commented 1 month ago

You can add more metadata with this syntax:

Metadata = new(
    id: "...",
    version: ExtensionAssemblyVersion,
    publisherName: "...",
    displayName: "...",
    description: "...")
{
    MoreInfo = "...",
    ReleaseNotes = "...",
    Tags = ["...", "....", "...", "...."],
    // TODO: BUG? License file is missing
    //License = "Resources/License.txt",
    Icon = "...",
    PreviewImage = "...",
},

Note the comments on the license property, I am unable to build when I set a value in there. It will always complain about not being able to find the license file.

Maybe someone can help me with that?

ThomasArdal commented 1 month ago

@sboulema That makes sense; thank you. I'm afraid I haven't gone so far as to run into the license issue.

BTW, do you know where to correctly set the version number? I'm not sure, but I guess that ExtensionAssemblyVersion normally would point to the version in the .vsixmanifest file. But since this is automatically generated for this kind of extension, I'm unsure where to define it. Could hard code it in the .cs file, of course.

Nevermind. I'll just set it in the .csproj file since I don't have an AssemblyInfo.cs file in my project:

<PropertyGroup>
  <AssemblyVersion>2.0.0</AssemblyVersion>
</PropertyGroup>
ThomasArdal commented 1 month ago

@mpeyrotc I will close this one since I have a working extension now. Thank you very much for your help.