Binding failed with netstandard project

Hi,

I’ve installed SonarLint and it work great.
Today I’ve tried to bind SonarQube project to my .NET project and it failed.

I pin point the problem is because my project was migrated to NetStandard2.0

Someone could help me

This is the error I receive from SonarLint when I try to bind it.

Ruleset binding: initial binding. All projects need to be updated to reference the generated ruleset.
Unexpected error during workflow execution: Type library exporter encountered an error while processing ‘Microsoft.VisualStudio.ProjectSystem.VS.PropertyPages.PropertyPage, Microsoft.VisualStudio.ProjectSystem.Managed.VS’. Error: Type library exporter encountered an error while processing ‘Microsoft.VisualStudio.Shell.Interop.SVsSolutionObject, Microsoft.VisualStudio.Shell.Interop’. Error: Type ‘SVsSolutionObject’ and type ‘SVsSolution’ both have the same UUID…

Hello @Guillaume, welcome to the community.

Thank you for reporting this to us. Can you please provide us with more information:

  1. What version is your Visual Studio?
  2. What is your SonarLint version?
  3. Can you please copy-paste the entire log in the output window, with the full stack trace?

Sure,

This is a VisualStudio version informations
Microsoft Visual Studio Professional 2019
Version 16.9.4
VisualStudio.16.Release/16.9.4+31205.134
Microsoft .NET Framework
Version 4.8.03752

The installed version of SonarLint is the latest (4.34.0.31639)

Full log (Don’t how I can have the full stack trace)
Connecting to SonarQube server: hidden
Connecting to SonarQube server: Validating credentials
Connecting to hidden
Connected to SonarQube ‘8.7.0.41497’.
Connecting to SonarQube server: Detecting server plugins
Discovered a supported plugin: Plugin: ‘SonarC#’, Language(s): ‘C#’, Installed version: ‘8.18.0’, Minimum version: ‘5.0’
Discovered a supported plugin: Plugin: ‘SonarVB’, Language(s): ‘VB.NET’, Installed version: ‘8.18.0’, Minimum version: ‘3.0’
Discovered a supported plugin: Plugin: ‘SonarCFamily’, Language(s): ‘C++, C’, Installed version: ‘6.17.0’, Minimum version: ‘6.0’
Connecting to SonarQube server: Retrieving projects
Connecting to SonarQube server: Succeeded
Connecting to SonarQube server: Downloading server settings.
Initializing the telemetry package…
Disconnecting…
Current VS version:
Visual Studio Professional 2019
16.9.31205.134
16.9.4
Finished initializing the telemetry package…
Initializing the SonarLint package…
Standalone mode detected.
Finishing initializing the SonarLint package
Initializing the notifications package…
Not connected: not checking for notifications
Finished initializing the notifications package
Initializing the daemon package…
Loaded settings from “C:\Users\hidden\AppData\Roaming\SonarLint for Visual Studio\settings.json”.
[Open in IDE] Creating request listener…
[Open in IDE] Checking availability of port 64120
[Open in IDE] Request listener created successfully. Listening on port 64120.
Finished initializing the daemon package.
Connecting to SonarQube server: hidden
Connecting to SonarQube server: Validating credentials
Connecting to hidden
Connected to SonarQube ‘8.7.0.41497’.
Connecting to SonarQube server: Detecting server plugins
Discovered a supported plugin: Plugin: ‘SonarC#’, Language(s): ‘C#’, Installed version: ‘8.18.0’, Minimum version: ‘5.0’
Discovered a supported plugin: Plugin: ‘SonarVB’, Language(s): ‘VB.NET’, Installed version: ‘8.18.0’, Minimum version: ‘3.0’
Discovered a supported plugin: Plugin: ‘SonarCFamily’, Language(s): ‘C++, C’, Installed version: ‘6.17.0’, Minimum version: ‘6.0’
Connecting to SonarQube server: Retrieving projects
Connecting to SonarQube server: Succeeded
Connecting to SonarQube server: Downloading server settings.
Establishing new binding…
Binding solution to SonarQube project: Started
Binding solution to SonarQube project: Discovering solution projects
Included projects:

  • CchUtils\CchUtils.csproj
    Excluded projects:
  • CchUtils.Tests\CchUtils.Tests.csproj
    You can change the exclusion options via the SonarLint project-level context menu i.e. Solution Explorer → Select project(s)
    Binding solution to SonarQube project: Download quality profile(s):
    Successfully downloaded quality profile. Name: ‘Sonar way’, Key: ‘hidden’, Language: ‘C#’
    INFO: SonarLint connected mode no longer installs the analyzers NuGet packages. The analyzers embedded in the VSIX are used instead.
    Binding solution to SonarQube project: Generating project rule sets
    Ruleset binding: initial binding. All projects need to be updated to reference the generated ruleset.
    Unexpected error during workflow execution: Type library exporter encountered an error while processing ‘Microsoft.VisualStudio.ProjectSystem.VS.PropertyPages.PropertyPage, Microsoft.VisualStudio.ProjectSystem.Managed.VS’. Error: Type library exporter encountered an error while processing ‘Microsoft.VisualStudio.Shell.Interop.SVsSolutionObject, Microsoft.VisualStudio.Shell.Interop’. Error: Type ‘SVsSolutionObject’ and type ‘SVsSolution’ both have the same UUID…

Hello @Guillaume, apologies for the delayed response.

Does this happen in other projects, or just this one?
Also, would you mind please testing an older version of SonarLint (i.e. v4.30) and checking if the error still reproduces?
(Please turn off auto-update of extensions before you do so, otherwise VS will update the extension back to the latest)

Hi,

I have same error in many projects. The only similarity between these projects is this NetStandard2.0 project.
I’ve tested the version 4.30 and I have same error

Thanks for checking v4.30 @Guillaume.

I haven’t been able to reproduce the problem locally, so we have some more questions:

(1) can you successfully bind a single new project that targets NET Standard?
(2) have you previously managed to bind projects successfully?
(3) how did you migrate your project to NetStandard 2.0?

FYI the underlying error looks like a problem with COM interop, which isn’t something that SLVS handles directly. I’ve found a similar problem reported here for a different extension. However, there’s no indication what the underlying problem was or how it was fixed :frowning:

Hi,

1: I created brand new project librairy .NetFramework 2.0 and I have the same error
2: Yew I can bind the project with .NET 4.7.2
3: migration was done manually by creating a new .net standard project and then importing / setting relelevant details for the project.

Thank you

@Guillaume could you share the new failing project please?

Sure

With this project I can’t bind any SonarQube project

NetStardardTest.zip (36.8 KB)

Thanks @Guillaume.

I managed to bind that project successfully:

I’m using the same version of SonarQube and the same build of VS (I’m using VS Enterprise rather Professional, but that shouldn’t make any difference here since Enterprise is a superset of Professional). I’m using a very slightly newer version of the .NET Framework, but that shouldn’t make any difference since the SVsSolution isn’t installed as part of the .NET Framework.

Microsoft Visual Studio Enterprise 2019
Version 16.9.4
VisualStudio.16.Release/16.9.4+31205.134
Microsoft .NET Framework
Version 4.8.04084

The error you are seeing looks like a problem calling one of the underlying VS COM-based services.
SonarLint, like all managed VS extensions, talks to these COM types via a generated interop wrapper. It’s normal for each extension to define its own .NET wrapper for a COM type. If the wrappers are correctly defined then the CLR is able to cast between the underlying COM types and .NET types because of type equivalence.

One possibility is that there is a problem with the COM wrappers in SonarLint, or in another component that you have installed that I don’t. Do you have any other extensions installed?

Hi,

I tried to remove and reinstall SonarLint, not worked

I tried to remove all extensions. The only extension I can’t remove because is installed with VS was

  • Cloud Explorer for VS 2019 Preview
  • Live Share
  • Microsoft Library Manager
  • NuGetRecommender
  • Visual Studio IntelliCode
  • Visual Studio Rich Navigation [Preview]
  • Web Live Preview (Preview)

Not worked

I tried to remove and reinstall SonarLint, not worked

I tried to uninstall and reinstall VS. After reinstall it, I have this extensions already installed

  • Visual Studio IntelliCode
  • Live Share
  • NugetRecommender [Preview]
  • Visual Studio Rich Navigation [Preview]
    I’ve installed latest version of SonarLint
    Still not work

Always same error