microsoft / vs-ng-language-service

Visual Studio extension for the Angular Language Service
MIT License
43 stars 15 forks source link

Error when activating the extension in VS2022 #45

Closed amoroso81 closed 1 year ago

amoroso81 commented 1 year ago

I unsuccessfully installed the version 1.0.3 of this extension on Visual Studio 2022 (version 17.3.5); it's not working and there is no output from it in VS. I attached the file with the error I found (AppData\Local\Microsoft\VisualStudio\17.0_963c871d\ComponentModelCache/Microsoft.VisualStudio.Default.err). I even tried a restart of the Windows 10 os, but same error. Please let me know if you need some additional info.

Microsoft.VisualStudio.Default.err.txt

MariaSolOs commented 1 year ago

Could you please try uninstalling the extension completely and reinstalling it again? Also, do you have version 2019 of the extension installed as well?

amoroso81 commented 1 year ago

Hi, I disinstalled the extension and then reinstalled it. The error is the same and I can't see the extension in the Output View. I don't have the 2019 version of the extension installed in VS2022. If it can be of any help, I have VS2022 installed alongside with VS2019 (16.11.6).

MariaSolOs commented 1 year ago

@amoroso81 So that I can better understand your local setup, could you please go to Help -> About Microsoft Visual Studio, click on "Copy info", and share the output here?

amoroso81 commented 1 year ago

Microsoft Visual Studio Community 2022 Version 17.3.5 VisualStudio.17.Release/17.3.5+32922.545 Microsoft .NET Framework Version 4.8.04084

Installed Version: Community

ASP.NET and Web Tools 17.3.376.3011 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.3.376.3011 Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.3.376.3011 Azure Functions and Web Jobs Tools

C# Tools 4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Node.js Tools 1.5.40629.1 Commit Hash:3f5cc0329815af3ffb948f08857446d206a9af36 Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 6.3.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387 Provides languages services for ASP.NET Core Razor.

SonarLint for Visual Studio 6.9.0.54300 SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.

SQL Server Data Tools 17.0.62207.04100 Microsoft SQL Server Data Tools

TypeScript Tools 17.0.10701.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

MariaSolOs commented 1 year ago

@amoroso81 Could you please try updating the extension to 1.1.0? #46 removed some dependencies that might be the culprit. To make sure that nothing is cached, please uninstall the extension completely (and remove C:\Users\x\AppData\Local\Microsoft\VisualStudio\17.0_963c871d\Extensions\4xycgkus.l2o) and reinstall the newest version.

Keep me updated!

amoroso81 commented 1 year ago

I installed the new version (1.1.0) of the extension after uninstalling and deleting the old one. Still the extension does not activate, but the exception stack trace at least has changed. Microsoft.VisualStudio.Default.err.txt

MariaSolOs commented 1 year ago

Okay @amoroso81, please try the following:

amoroso81 commented 1 year ago

After upgrading Visual Studio 2022 to version 17.3.6, this is the error I get now: Microsoft.VisualStudio.Default.err.txt Now I try to remove the specified dlls.

amoroso81 commented 1 year ago

After removing the dlls, the extension is still not activating, but there is no error at the usual path in \ComponentModelCache.

MariaSolOs commented 1 year ago

@amoroso81 Just to be sure, are you opening a TypeScript or component.html file? That is the only way in which the extension will be activated.

amoroso81 commented 1 year ago

Yes, I open both each time, but no error after having removed those dlls. After upgrading Vs, I had a different error. No output also both times.

MariaSolOs commented 1 year ago

@amoroso81 this is so strange, from the last error file it seems like the extension's DLL is correctly being loaded. However, the problems are now coming from C++ assemblies. What workloads do you have in your VS installation?

amoroso81 commented 1 year ago

Yes, I agree with you that it's strange. I don't have any project written in C++, so I can do without it. Shall I remove C++ support from the VS installer?

MariaSolOs commented 1 year ago

Yes, I agree with you that it's strange. I don't have any project written in C++, so I can do without it. Shall I remove C++ support from the VS installer?

It's worth a try IMO.

amoroso81 commented 1 year ago

I checked and I didn't have the support for C++ installed in VS 2022. By the way, I removed the wokloads related to .Net desktop and NodeJs which I didn't use and now I have installed only the Web workload. This is the error I get now:

Microsoft.VisualStudio.Default.err.txt

Obviously, I haven't reinstalled the extension after having removed all the specified dlls.

MariaSolOs commented 1 year ago

From your last log file it seems like there are no signing errors anymore and the extension is getting loaded. Given that other users have been able to use the extension without encountering this issue, I believe that there must be something specific to your setup that's problematic.

Do you have any preview features enabled?

amoroso81 commented 1 year ago

No, I don't have any preview features enabled. By the way, I upgraded VS to version 17.4.0 and this is the error I get now:

Microsoft.VisualStudio.Default.err.txt

Khyalis commented 1 year ago

For me, it is working. But! Apparently, there is an exception to strong name verification registered:

>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe" -Vl

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly/Strong Name                  Users
===========================================
*,*                                   All users

I do not know how it got there, I had not put it there.

Anyway I went on and unregistered it.

And now it does not work for me, either.

I tried something else then:

>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe" -vf "C:\Users\...\AppData\Local\Microsoft\VisualStudio\17.0_36129326\Extensions\acsq43yh.ve3\AngularLanguageService.2022.dll"

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

C:\Users\...\AppData\Local\Microsoft\VisualStudio\17.0_36129326\Extensions\acsq43yh.ve3\AngularLanguageService.2022.dll is a delay-signed or test-signed assembly

Maybe it should not be delay-signed or test-signed?

Khyalis commented 1 year ago

In the past, I had been having issues when trying to "Include" build artifacts or files, that did not yet exist at build begin into ItemGroups. Things did seem to work okay when (re)building locally, but not so much on the build agent when it was performing a clean build.

I wonder, if this be an issue here regarding "FilesToSign".

https://github.com/microsoft/vs-ng-language-service/pull/7 appears to suggest that there had been issues getting the assembly signed earlier.

MariaSolOs commented 1 year ago

@Khyalis the extension has to be delay-signed because of strong name signing. However, your comments do provide me important hints and so now I'm working on a fix.

MariaSolOs commented 1 year ago

Oops I didn't want to close this yet. First I want to make sure the issue is actually solved for y'all.

@amoroso81 could you please try installing version 1.1.2 of the extension? Please follow these steps to make sure we're beginning from a clean slate :)

Khyalis commented 1 year ago

@Khyalis the extension has to be delay-signed because of strong name signing. However, your comments do provide me important hints and so now I'm working on a fix.

I couldn't hope for anything more.

Great job.

For me, the extension is now activating even with all verification exceptions turned off (in 17.4.0 and 17.5.0 Preview 1.0), also sn.exe -v(f) says the assembly is "valid" now.

MariaSolOs commented 1 year ago

That's wonderful, thanks to YOU @Khyalis!

MariaSolOs commented 1 year ago

@amoroso81 please let me know if things are finally working for you! I won't close this issue until then :)

amoroso81 commented 1 year ago

Maria, this was the no. 1 task on my agenda today. I can confirm that, after uninstalling the extension and reinstalling it, it now initializes successfully in VS 2022. In the output I found two strange things btw: it uses the wrong Angular version (14.2.0 instead of 12.2.15) and it raised an error when using it on a *.component.html file (No config file for "name_of_the_file"). Is there any documentation about this extension? However, thanks for the support and the patience.

MariaSolOs commented 1 year ago

@amoroso81 yay! I'm glad that we finally got the extension to initialize for you. Thank you for your patience! I'll close this now since the original problem has been fixed.

it uses the wrong Angular version (14.2.0 instead of 12.2.15)

That is to be expected, since this extension will load the Angular server from the bundled npm module. It does sound like a reasonable request to make this configurable, so I created #53 for it.

it raised an error when using it on a *.component.html file (No config file for "name_of_the_file")

That error is no longer coming from this extension. This repo has the editor integration for the Angular language service (documented here), we're basically just a "wrapper" around that server.