Sonarlint don't raise any issue

Hi,

I have a private sonarqube server and I’ve connect my local Sonarlint with it,
When run the analysis on Rider (on Intel Mac OS) always return no issue/smell code found, but when I run the same code on CI, I can see a lot of issue/smell code

Hi @lillo42,

Can you please add more information:

  • Sonarqube version
  • Rider version
  • SonarLint version
  • Which languages are you trying to analyze? (C# / VB?)
  • Can you give an example of a code snippet that is supposed to raise an issue in the IDE? It would help if you can share a project with us that reproduces this issue.

@rita.g

Rider and SonarLint version:

JetBrains Rider 2021.3.3
Build #RD-213.6775.4, built on January 26, 2022
Subscription is active until December 19, 2022.
Runtime version: 11.0.13+7-b1751.25 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 12.2.1
.NET 6.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 6000M
Cores: 8
Registry:
ide.mac.bigsur.window.with.tabs.enabled=false
documentation.show.toolbar=true
rdclient.asyncActions=false
ide.new.project.model.index.case.sensitivity=true
indexing.enable.entity.provider.based.indexing=false

Non-Bundled Plugins:
org.sonarlint.idea (6.5.1.43866)
nsubstitutecomplete-rider (1.6.1)
fr.socolin.application-insights-debug-log-viewer (1.3.0)
eu.gillissen.rider.usersecrets (1.2.0)
com.settler.rider.specflow (1.10.2)
com.mzyupc.a-redis (beta-0.7.0)
com.intellij.rider.plugins.nuke (2021.3.0)
com.intellij.resharper.StructuredLogging (2021.3.3.184)
com.bruce.intellijplugin.RedisPlugin (2021.12.07)
com.intellij.plugin.adernov.powershell (2.0.10)
com.intellij.resharper.azure (3.50.0.1314-2021.3)
IdeaVIM (1.10.0)
mobi.hsz.idea.gitignore (4.3.0)
aws.toolkit (1.40-213)
Abc.MoqComplete.Rider (1.4.11)

SonarLint plugin version → 6.5.1.43866

Which languages are you trying to analyze?

C# 10

Can you give an example of a code snippet that is supposed to raise an issue in the IDE? I

            var cryptoServiceProvider = new RSACryptoServiceProvider();

On sonaqube dashboard I can see this error: S4426, but on my local machine there is no error

Hi @lillo42

I managed to have issues for the same code snippet, but I am on Linux.

Your problem might be platform specific, and caused by an error to process your project with OmniSharp. To investigate, we would need the detailed logs when OmniSharp starts. To do that, please go to the SonarLint log panel, and enable verbose + analysis logs:

Then close your solution (or Rider) and reopen the solution. In the SonarLint log tab, you should see a lot of logs. Please share them in the thread, or privately if you are concerned by privacy.

For example, on my side, the interesting logs start with:

Execute Sensor: OmniSharp
Starting OmniSharp...
Omnisharp: [DEBUG] Loaded OmniSharp.Cake, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.DotNetTest, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.Host, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.MSBuild, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.Roslyn, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.Roslyn.CSharp, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.Script, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [DEBUG] Loaded OmniSharp.Shared, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
Omnisharp: [INFORMATION] Starting OmniSharp on fedora 34.0 (x64)
[...]

Thanks

@Julien_HENRY Follow attached the logs, sonar.json (192.1 KB)

Omnisharp: [ERROR] Project '../../99_Models/CarNext.Users.Service.Models/CarNext.Users.Service.Models.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.
Omnisharp: [ERROR] Project '../CarNext.Extensions.Jwt/CarNext.Extensions.Jwt.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.
Omnisharp: [WARNING] Failed to load project file '/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0/CarNext.Users.Connectors.Auth0.csproj'.
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0/CarNext.Users.Connectors.Auth0.csproj","Warnings":[],"Errors":[{"LogLevel":"Error","FileName":"/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets","Text":"Project '../../99_Models/CarNext.Users.Service.Models/CarNext.Users.Service.Models.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.","StartLine":0,"StartColumn":0,"EndLine":0,"EndColumn":0},{"LogLevel":"Error","FileName":"/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets","Text":"Project '../CarNext.Extensions.Jwt/CarNext.Extensions.Jwt.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.","StartLine":0,"StartColumn":0,"EndLine":0,"EndColumn":0}]},"Seq":150,"Type":"event"}
Omnisharp: [INFORMATION] Loading project: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0.Unit.Tests/CarNext.Users.Connectors.Auth0.Unit.Tests.csproj
Omnisharp: [ERROR] Project '../CarNext.Users.Connectors.Auth0/CarNext.Users.Connectors.Auth0.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.
Omnisharp: [WARNING] Failed to load project file '/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0.Unit.Tests/CarNext.Users.Connectors.Auth0.Unit.Tests.csproj'.
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0.Unit.Tests/CarNext.Users.Connectors.Auth0.Unit.Tests.csproj","Warnings":[],"Errors":[{"LogLevel":"Error","FileName":"/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets","Text":"Project '../CarNext.Users.Connectors.Auth0/CarNext.Users.Connectors.Auth0.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v6.0'.","StartLine":0,"StartColumn":0,"EndLine":0,"EndColumn":0}]},"Seq":154,"Type":"event"}
Omnisharp: [INFORMATION] Loading project: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/_build.csproj
Omnisharp: [ERROR] Assets file '/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v6.0'. Ensure that restore has run and that you have included 'net60' in the TargetFrameworks for your project.
Omnisharp: [WARNING] Failed to load project file '/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/_build.csproj'.
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/_build.csproj","Warnings":[],"Errors":[{"LogLevel":"Error","FileName":"/usr/local/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets","Text":"Assets file '/Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v6.0'. Ensure that restore has run and that you have included 'net60' in the TargetFrameworks for your project.","StartLine":208,"StartColumn":5,"EndLine":0,"EndColumn":0}]},"Seq":158,"Type":"event"}
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/99_Models/CarNext.Users.Service.Models/CarNext.Users.Service.Models.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/10_Clients/CarNext.Users.Service.Api/CarNext.Users.Service.Api.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/10_Clients/CarNext.Users.Service.Api.Tests/CarNext.Users.Service.Api.Tests.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/90_Storage/CarNext.Users.Service.Storage/CarNext.Users.Service.Storage.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/99_Models/CarNext.Users.Service.Entities/CarNext.Users.Service.Entities.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/99_Models/CarNext.Users.Service.Settings/CarNext.Users.Service.Settings.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Library.Tests/CarNext.Users.Service.Library.Tests.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Email.Templating/CarNext.Users.Service.Email.Templating.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Email/CarNext.Users.Service.Email.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Library/CarNext.Users.Service.Library.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Core/CarNext.Users.Service.Core.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/99_Models/CarNext.User.Importer.Entities/CarNext.User.Importer.Entities.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/90_Storage/CarNext.User.Importer.Storage/CarNext.User.Importer.Storage.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Core.Tests/CarNext.Users.Service.Core.Tests.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Extensions.Jwt/CarNext.Extensions.Jwt.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Salesforce/CarNext.Users.Service.Salesforce.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Service.Salesforce.Tests/CarNext.Users.Service.Salesforce.Tests.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0/CarNext.Users.Connectors.Auth0.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/src/50_Library/CarNext.Users.Connectors.Auth0.Unit.Tests/CarNext.Users.Connectors.Auth0.Unit.Tests.csproj
Omnisharp: [ERROR] Attempted to update project that is not loaded: /Users/rlillo/Documents/git-lab/backend/ecommerce-users-service/build/_build.csproj
Error executing sensor: 'OmniSharp'

java.lang.IllegalStateException: Unable to start OmniSharp
	at org.sonarsource.sonarlint.omnisharp.OmnisharpSensor.execute(OmnisharpSensor.java:102)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
	at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.startComponents(ComponentContainer.java:119)
	at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.execute(ComponentContainer.java:104)
	at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:152)
	at 
org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:70)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalStateException: Timeout waiting for solution/project configuration to be loaded
	at org.sonarsource.sonarlint.omnisharp.OmnisharpServer.doStart(OmnisharpServer.java:198)
	at org.sonarsource.sonarlint.omnisharp.OmnisharpServer.lazyStart(OmnisharpServer.java:148)
	at org.sonarsource.sonarlint.omnisharp.OmnisharpSensor.execute(OmnisharpSensor.java:96)
	... 11 more

I don’t know if it’s make difference but I’m using a central package version and .NET version is define on Directory.Build.props,

Very similar as I made here: GitHub - lillo42/NServiceBus.Automatonymous

@Julien_HENRY do you need more info? Or is that log enough?

Hello @lillo42,

My apologies for the delayed response. We’ve investigated the issue and indeed there is a problem which we’ve created a ticket for.

There is a workaround you could try and that is specified in the ticket:

  1. Create a file omnisharp.json with the content { "msbuild": { "useBundledOnly": true } }
  2. Place the file next to your solution file
  3. Close and reopen the solution

This should solve the problem. Please let me know if that worked for you.

Best,
Rita

1 Like