csoltenborn / GoogleTestAdapter

Visual studio extension that adds support for the C++ testing framework Google Test.
Other
142 stars 101 forks source link

Visual Studio 2022 support #333

Open GSonofNun opened 3 years ago

GSonofNun commented 3 years ago

Simple request for support for Visual Studio 2022.

Installation fails: image

Log:

10/20/2021 11:15:14 AM - Microsoft VSIX Installer
10/20/2021 11:15:14 AM - -------------------------------------------
10/20/2021 11:15:14 AM - vsixinstaller.exe version:
10/20/2021 11:15:14 AM - 17.0.5226-preview5
10/20/2021 11:15:14 AM - -------------------------------------------
10/20/2021 11:15:14 AM - Command line parameters:
10/20/2021 11:15:14 AM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\joshg\AppData\Local\Temp\MicrosoftEdgeDownloads\dadad0a7-01a4-405b-9ea5-caf4dc977732\GoogleTestAdapter-0.18.0.vsix
10/20/2021 11:15:14 AM - -------------------------------------------
10/20/2021 11:15:14 AM - Microsoft VSIX Installer
10/20/2021 11:15:14 AM - -------------------------------------------
10/20/2021 11:15:15 AM - Skipping product Microsoft.VisualStudio.Product.BuildTools (3bb528d2) since it does not support extensions
10/20/2021 11:15:15 AM - Initializing Install...
10/20/2021 11:15:15 AM - Extension Details...
10/20/2021 11:15:15 AM -    Identifier         : GoogleTestAdapterVSIX.e57b9720-dfde-4baa-bcb5-0f75772012b4
10/20/2021 11:15:15 AM -    Name               : Google Test Adapter
10/20/2021 11:15:15 AM -    Author             : Christian Soltenborn
10/20/2021 11:15:15 AM -    Version            : 0.18.0.1432
10/20/2021 11:15:15 AM -    Description        : Adds support for the C++ unit testing framework Google Tests.
10/20/2021 11:15:15 AM -    Locale             : en-US
10/20/2021 11:15:15 AM -    MoreInfoURL        : https://github.com/csoltenborn/GoogleTestAdapter
10/20/2021 11:15:15 AM -    InstalledByMSI     : False
10/20/2021 11:15:15 AM -    SupportedFrameworkVersionRange : [4.5,4.7]
10/20/2021 11:15:15 AM - 
10/20/2021 11:15:15 AM -    SignatureState     : Unsigned
10/20/2021 11:15:15 AM -    Supported Products : 
10/20/2021 11:15:15 AM -        Microsoft.VisualStudio.Pro
10/20/2021 11:15:15 AM -            Version : [12.0,17.0)
10/20/2021 11:15:15 AM -            ProductArchitecture : x86
10/20/2021 11:15:15 AM -        Microsoft.VisualStudio.Enterprise
10/20/2021 11:15:15 AM -            Version : [12.0,17.0)
10/20/2021 11:15:15 AM -            ProductArchitecture : x86
10/20/2021 11:15:15 AM -        Microsoft.VisualStudio.Ultimate
10/20/2021 11:15:15 AM -            Version : [12.0,17.0)
10/20/2021 11:15:15 AM -            ProductArchitecture : x86
10/20/2021 11:15:15 AM -        Microsoft.VisualStudio.Community
10/20/2021 11:15:15 AM -            Version : [12.0,17.0)
10/20/2021 11:15:15 AM -            ProductArchitecture : x86
10/20/2021 11:15:15 AM - 
10/20/2021 11:15:15 AM -    References         : 
10/20/2021 11:15:15 AM -    Prerequisites      : 
10/20/2021 11:15:15 AM -        -------------------------------------------------------
10/20/2021 11:15:15 AM -        Identifier   : Microsoft.VisualStudio.Component.CoreEditor
10/20/2021 11:15:15 AM -        Name         : Visual Studio core editor
10/20/2021 11:15:15 AM -        Version      : [15.0,)
10/20/2021 11:15:15 AM - 
10/20/2021 11:15:15 AM -        -------------------------------------------------------
10/20/2021 11:15:15 AM -        Identifier   : Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core
10/20/2021 11:15:15 AM -        Name         : Visual Studio C++ core features
10/20/2021 11:15:15 AM -        Version      : [15.0,)
10/20/2021 11:15:15 AM - 
10/20/2021 11:15:15 AM - Signature Details...
10/20/2021 11:15:15 AM -    Extension is not signed.
10/20/2021 11:15:15 AM - 
10/20/2021 11:15:15 AM - Searching for applicable products...
10/20/2021 11:15:15 AM - Found installed product - Global Location
10/20/2021 11:15:15 AM - Found installed product - Visual Studio Enterprise 2022 Preview
10/20/2021 11:15:15 AM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
csoltenborn commented 3 years ago

Thanks for the request! I will look into this in the next two or three weeks (in fact, MS has already contacted me by me about this). However, I fear that this would mean to support two versions of the adapter ("pre-20222" and "2022 and later"), and I'm not sure whether I'm willing to go that way. I'm not completely sure from the technical point of view, though - I'll let you know.

acangialosi commented 3 years ago

@csoltenborn I noticed you are starting to update your VS extension. If you have any issues upgrading the extension please feel free to reach out and we can loop in folks from the engineering team to help out. Do you have an idea of when you expect to publish your new version?

csoltenborn commented 3 years ago

@acangialosi In fact it's quite the opposite, I fear (see my comment above yours ;-) ). As far as I have understood, there's no way to deliver a single extension which supports not only the new VS 2021, but also VS down to VS2015. Thus, I'd had to split up my extension, and I had to provide two different versions via the VS marketplace. Can you confirm this?

acangialosi commented 3 years ago

Hi Christian. I can confirm that it is a requirement for the extension to fork to a separate download page at this time. The marketplace has a work item to support multiple versions from a single page but that isn't available yet. If a single web page is important you can switch the download page to a reference link to another site that helps users pick the correct download. In that case though the automatic updates form the IDE won't be enable so it isn't a perfect solution. I am passing on this feedback to the marketplace team as we work with them to get this resolve in the future.


From: Christian Soltenborn @.> Sent: Wednesday, November 3, 2021 11:37 PM To: csoltenborn/GoogleTestAdapter @.> Cc: Anthony Cangialosi [MS] @.>; Mention @.> Subject: Re: [csoltenborn/GoogleTestAdapter] Visual Studio 2022 support (Issue #333)

@acangialosihttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Facangialosi&data=04%7C01%7C%7Cf6a05dc8deaa49eb092b08d99f5da081%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637716046742291709%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=j2ClGdxb4akPVHhM%2ByvlZQXugKK5prapGfxZSWAiI70%3D&reserved=0 In fact it's quite the opposite, I fear (see my comment above yours ;-) ). As far as I have understood, there's no way to deliver a single extension which supports not only the new VS 2021, but also VS down to VS2015. Thus, I'd had to split up my extension, and I had to provide two different versions via the VS marketplace. Can you confirm this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsoltenborn%2FGoogleTestAdapter%2Fissues%2F333%23issuecomment-960494640&data=04%7C01%7C%7Cf6a05dc8deaa49eb092b08d99f5da081%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637716046742301665%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1EaAz876IaVHLNPDVUCs4E6g5%2Fk5tDq3sFc3tUqkZ2A%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABJUI4QUHWWPGQYG67LPZA3UKIS37ANCNFSM5GL5FCXQ&data=04%7C01%7C%7Cf6a05dc8deaa49eb092b08d99f5da081%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637716046742301665%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=M1ajsYZkGJUKZOfao94jVd6tVVA%2BdXMyUZX3%2FxyhaXk%3D&reserved=0.

csoltenborn commented 3 years ago

@acangialosi It is less of a problem to have two separate pages on the marketplace (I just mentioned this to make clear what I mean), but to take care of "two version" of GTA. At the moment, I think that I'm not going to go that way. This is mainly because at my current job, I'm not using GTA any more, which is why I have spent less time on this project in the last year or so. Plus, there's MS's fork of GTA (TAfGT), which I assume is already ported to VS2021 (or will be ported soon) - TAfGT is based on an older version of GTA (0.10 or 0.11 if I remember correctly), so users will loose some features, but the most important ones will still be available (plus, my code will continue to live :-) ). In fact, at the moment users have to opt out of using TAfGT during installation of VS and then manually install GTA, and I don't think that many users are doing that anyways.

mike10004 commented 2 years ago

In fact, at the moment users have to opt out of using TAfGT during installation of VS and then manually install GTA, and I don't think that many users are doing that anyways.

Opting out and manually installing GTA is what I do, because TAfGT interprets skipped tests as crashes, which is a dealbreaker for me.

For other users wondering about a temporary workaround, what I did was download the v0.18.0 .vsix release of the extension, unzip it, and edit extension.vsixmanifest to change

<Installation InstalledByMsi="false">
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Pro" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Enterprise" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Ultimate" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Community" />
</Installation>

so that it looks like this:

<Installation InstalledByMsi="false">
  <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
    <ProductArchitecture>amd64</ProductArchitecture>
  </InstallationTarget>
</Installation>

Then zip up the directory and change the extension to .vsix and install by double-clicking it in Windows Explorer.

(I get a message dialog about the GoogleTestExtensionOptionsPage not loading correctly, but I have gotten that in the past, and I always assumed it was somehow related to replacing TAfGT with GTA.)

bdalessandro commented 2 years ago

@mike10004 That lets me install the extension, but I still can't actually run any of the tests (the output log shows that it promptly throws an exception when I try). Were you able to run tests?

TAfGT likewise does not work for me since it reports GTEST_SKIP as an error rather than a skipped test like you describe.

mike10004 commented 2 years ago

That lets me install the extension, but I still can't actually run any of the tests (the output log shows that it promptly throws an exception when I try). Were you able to run tests?

@bdalessandro I was able to run the tests successfully after rebuilding the solution.

csoltenborn commented 2 years ago

Wow - I'm kind of honored by you posting a workaround to still use my adapter ;-)

In fact I'm a bit surprised that this works (and I'm wondering whether it will continue working with the final version of VS), since the migration guide states that "Extensions with running code must be compiled specifically for Visual Studio 2022."...

echalone commented 2 years ago

I can confirm that Google Test Adapter 0.18.0 still works with Visual Studio 2022. You can't install it for that Visual Studio of course, but if you just unpack the vsix (it's a zip after all) into some random directory and use that directory as a test adapter when calling vstest.console.exe of VS 2022 then there's no problem with it. :)

bdalessandro commented 2 years ago

@mike10004 Thanks, yes, that worked!... after fully cleaning & rebuilding, I can run the tests using your workaround.

@csoltenborn Your adapter has features that Microsoft's fork does not, like Skipped tests! I was nearly ready to try and rebuild your extension myself, even though i have no C# or extension experience.

echalone commented 2 years ago

The main problem seems to be, that the Microsoft.VisualStudio.Shell.12.0.dll cannot be found in Visual Studio 2022 (according to the ActivityLog), as it's no longer shipped in the public (\Common7\IDE\PublicAssemblies) or private (\Common7\IDE\PrivateAssemblies) assemblies of that product. Which is why that GoogleTestExtensionOptionsPage error is displayed. The only one being shipped with it is Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0 (in the public assemblies). Funny enough, if you copy the dll into the private assembly folder of your VS 2022 installation, it will break with error "method EnvDTE.Solution EnvDTE._DTE.get_Solution not found", which is probably a method no longer supported with VS 2022.

I've tried to update the libraries to their Version 17. but am then getting various errors (about 22 of them) during building. Mostly "Interop type 'RegistrationAttribute' cannot be embedded. Use the applicable interface instead." and similar. I've cloned the repo and published my changes to my own repo in the branches User/echalone/VS2022Update_Community (for building with VS 2022 Community Edition) and User/echalone/VS2022Update_Enterprise (for building with VS 2022 Enterprise Edition). Maybe somebody can go from there and try to get it to work? I'm a bit lost at that point ^^

slymz commented 2 years ago

In fact, at the moment users have to opt out of using TAfGT during installation of VS and then manually install GTA, and I don't think that many users are doing that anyways

We are doing that. The entire company!

TAfGT is broken on so many levels. Trivial requests on developercommunity are ignored without action (Example1, example2, example3, ...). And the issue list in GitHub lately seems to be a goner - see https://github.com/microsoft/TestAdapterForGoogleTest, no "Issues", problem solved! :/

Tried VS 2022 latest version as of today with TAfGT. Broken. Most tests are not discoverable, without any helpful diagnostics as to what is going on. GTA with VS 2019, same exact solution and projects. Works perfectly.

alex-nl commented 2 years ago

In fact, at the moment users have to opt out of using TAfGT during installation of VS and then manually install GTA, and I don't think that many users are doing that anyways.

Opting out and manually installing GTA is what I do, because TAfGT interprets skipped tests as crashes, which is a dealbreaker for me.

For other users wondering about a temporary workaround, what I did was download the v0.18.0 .vsix release of the extension, unzip it, and edit extension.vsixmanifest to change

<Installation InstalledByMsi="false">
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Pro" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Enterprise" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Ultimate" />
  <InstallationTarget Version="[12.0,17.0)" Id="Microsoft.VisualStudio.Community" />
</Installation>

so that it looks like this:

<Installation InstalledByMsi="false">
  <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
    <ProductArchitecture>amd64</ProductArchitecture>
  </InstallationTarget>
</Installation>

Then zip up the directory and change the extension to .vsix and install by double-clicking it in Windows Explorer.

(I get a message dialog about the GoogleTestExtensionOptionsPage not loading correctly, but I have gotten that in the past, and I always assumed it was somehow related to replacing TAfGT with GTA.)

Thanks for this, I was able to manually install in VS2022 as well.

Has anyone noticed any genuine issues with the Microsoft.VisualStudio.Shell.12.0.dll error, or is it just visual noise?

bdalessandro commented 2 years ago

Has anyone noticed any genuine issues with the Microsoft.VisualStudio.Shell.12.0.dll error, or is it just visual noise?

The only issue I've noticed is that I can't debug into a unit test. If I set a breakpoint & debug the test, the test will simply fully run & never stop at the breakpoint.

alex-nl commented 2 years ago

The only issue I've noticed is that I can't debug into a unit test. If I set a breakpoint & debug the test, the test will simply fully run & never stop at the breakpoint.

I see in the test logs it says [13:42:03.886 ERROR] Debugging is only possible if GoogleTestAdapter has been installed into Visual Studio - NuGet installation does not support this (and other features such as Visual Studio Options, toolbar, and solution settings).

So I suppose this has to do with the manual installation.

stefan-muc commented 1 year ago

For other users wondering about a temporary workaround, what I did was download the v0.18.0 .vsix release of the extension, unzip it, and edit extension.vsixmanifest to change

[...]

Then zip up the directory and change the extension to .vsix and install by double-clicking it in Windows Explorer. (I get a message dialog about the GoogleTestExtensionOptionsPage not loading correctly, but I have gotten that in the past, and I always assumed it was somehow related to replacing TAfGT with GTA.)

Thanks for this, I was able to manually install in VS2022 as well.

Sadly I didn't get this workaround to work anymore. I'm using Visual Studio 2022 Version 17.6.4 and after installing and starting Visual Studio I get this error message:

image

Test Explorer shows this line: image

Is there anything that I can do about it?