C# analyzer is not loading

Please provide

  • Operating system: Windows 11
  • SonarQube for IntelliJ plugin version: 10.15.0.80347
  • IntelliJ version: Rider 2024.3.4
  • Programming language you’re coding in: C#
  • Is connected mode used: Yes
    • SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?): SonarQube Server

And a thorough description of the problem / question:

Sonarlint is failing to provide any warnings at all for C# code. This is occurring for both automatic and manual analysis. I’ve tried the following solutions:

  1. Restarting Rider
  2. Restarting Machine
  3. Invalidating Rider caches
  4. Reinstalling Sonarlint plugin

The error being shown is the following:

[2025-01-30T08:50:16.046] [sonarlint-analysis-engine] ERROR org.sonarsource.sonarlint.omnisharp.protocol.OmnisharpEndpoints - "System.InvalidOperationException: Analyzer assembly could not be loaded: C:\\Users\\amagallon\\AppData\\Local\\JetBrains\\Rider2024.3\\tmp\\sonarlint\\.sonarlinttmp_510865449475769946\\slServices\\analyzers\\SonarAnalyzer.CSharp.dll  
    at SonarLint.OmniSharp.DotNet.Services.DiagnosticWorker.SonarAnalyzerAssembliesProvider.LoadAssemblies()  
    at SonarLint.OmniSharp.DotNet.Services.DiagnosticWorker.SonarAnalyzerAssembliesProvider.get_Assemblies()  
    at lambda_method289(Closure, LifetimeContext, CompositionOperation)  
    at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)  
    at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)  
    at lambda_method291(Closure, LifetimeContext, CompositionOperation)  
    at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)  
    at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)  
    at lambda_method292(Closure, LifetimeContext, CompositionOperation)  
    at System.Composition.TypedParts.ActivationFeatures.DisposalFeature.<>c__DisplayClass0_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)  
    at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)  
    at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)  
    at lambda_method296(Closure, LifetimeContext, CompositionOperation)  
    at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)  
    at System.Composition.Hosting.Providers.Lazy.LazyWithMetadataExportDescriptorProvider.<>c__DisplayClass2_3`2.<GetLazyDefinitions>b__4()  
    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)  
    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)  
    at System.Lazy`1.CreateValue()  
    at OmniSharp.Endpoint.EndpointHandler`2.<>c.<LoadExportHandlers>b__11_0(Lazy`2 export) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 80  
    at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext()  
    at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)  
    at System.Linq.Enumerable.GroupByIterator`2.MoveNext()  
    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)  
    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)  
    at OmniSharp.Endpoint.EndpointHandler`2.LoadExportHandlers(IEnumerable`1 handlers) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 79  
    at OmniSharp.Endpoint.EndpointHandler`2.<>c__DisplayClass10_0.<.ctor>b__0() in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 74  
    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)--- End of stack trace from previous location ---  
    at System.Lazy`1.CreateValue()  
    at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 221  
    at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 130  
    at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /home/vsts/work/1/s/src/OmniSharp.Stdio/Host.cs:line 218"`

Hi,

Welcome to the community!

What version of SonarQube Server are you connecting to?

 
Thx,
Ann

Hello. I believe we’re on SonarQube 10.7

Hi @Antonio_Magallon , Could you tell me if this is also happening in one of the following cases:

Same project when not connected
Different project not connected
Different project and connected

Thank you

Yes, I first tried turning off connected mode to see if it had anything to do with our sonarqube server. I was still receiving the same error in this case though.

We don’t have any other projects that have a sonarqube server setup so I can’t test another project in connected mode.

I did try another project without connected mode, a much smaller project, and I was still getting the same error.

I also tried updating sonarlint plugin to its latest version: 10.16.1.80464

Here is the full logs with Analysis mode and Verbose logs enabled.

sonarlint-error.txt (34.2 KB)

Hi @Antonio_Magallon could you check if the file actually exists in the path you shared:

C:\Users\amagallon\AppData\Local\JetBrains\Rider2024.3\tmp\sonarlint\.sonarlinttmp_510865449475769946\slServices\analyzers\SonarAnalyzer.CSharp.dll

That particular one I could not find, however, I re-ran sonarlint and got the same error for a different location of that analyzer.

[2025-02-06T10:29:02.405] [sonarlint-analysis-engine] ERROR org.sonarsource.sonarlint.omnisharp.protocol.OmnisharpEndpoints - "System.InvalidOperationException: Analyzer assembly could not be loaded: C:\\Users\\amagallon\\AppData\\Local\\JetBrains\\Rider2024.3\\tmp\\sonarlint\\.sonarlinttmp_2445216653310079117\\slServices\\analyzers\\SonarAnalyzer.CSharp.dll\r\n   at SonarLint.OmniSharp.DotNet.Services.DiagnosticWorker.SonarAnalyzerAssembliesProvider.LoadAssemblies()\r\n   at SonarLint.OmniSharp.DotNet.Services.DiagnosticWorker.SonarAnalyzerAssembliesProvider.get_Assemblies()\r\n   at lambda_method289(Closure, LifetimeContext, CompositionOperation)\r\n   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)\r\n   at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)\r\n   at lambda_method291(Closure, LifetimeContext, CompositionOperation)\r\n   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)\r\n   at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)\r\n   at lambda_method292(Closure, LifetimeContext, CompositionOperation)\r\n   at System.Composition.TypedParts.ActivationFeatures.DisposalFeature.<>c__DisplayClass0_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)\r\n   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)\r\n   at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)\r\n   at lambda_method296(Closure, LifetimeContext, CompositionOperation)\r\n   at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)\r\n   at System.Composition.Hosting.Providers.Lazy.LazyWithMetadataExportDescriptorProvider.<>c__DisplayClass2_3`2.<GetLazyDefinitions>b__4()\r\n   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)\r\n   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)\r\n   at System.Lazy`1.CreateValue()\r\n   at OmniSharp.Endpoint.EndpointHandler`2.<>c.<LoadExportHandlers>b__11_0(Lazy`2 export) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 80\r\n   at System.Linq.Enumerable.ArrayWhereSelectIterator`2.MoveNext()\r\n   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)\r\n   at System.Linq.Enumerable.GroupByIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)\r\n   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)\r\n   at OmniSharp.Endpoint.EndpointHandler`2.LoadExportHandlers(IEnumerable`1 handlers) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 79\r\n   at OmniSharp.Endpoint.EndpointHandler`2.<>c__DisplayClass10_0.<.ctor>b__0() in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 74\r\n   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)\r\n--- End of stack trace from previous location ---\r\n   at System.Lazy`1.CreateValue()\r\n   at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 221\r\n   at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /home/vsts/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 130\r\n   at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /home/vsts/work/1/s/src/OmniSharp.Stdio/Host.cs:line 218"

I also checked the file creation time and it looks like it was created a few seconds before sonarlint attempted to access it.

Hey @Antonio_Magallon,

just for your info as there is no response yet: We are actively working internally to try to reproduce the issue and to provide a fix for that!

Just bear with us that it might take a few days.

Best,
Tobias

1 Like

Thanks for the confirmation Tobias. I understand this is an odd one. I haven’t seen any other duplicates of this issue, and I haven’t run into this issue on any other machine that I use. I did try a few other things on my end. I went down the list of older versions of Sonarlint that were still compatible. I was finally able to get version 10.12.0.79769 to work properly so I’ll stay on this version for now. Let me know if you’d like I can provide some info logs from running this version.

Hope this helps.

Good morning Tobias (your system won’t let me @ you). Just wanted to see if there was any update to this issue since it’s been over a month since we last spoke. For reference, I have recently tried updating to the latest version of the plugin again 10.19.0.80823 and the issue persists.

I haven’t seen/heard of anyone else running into this issue, neither online nor in my org. I have to assume this is something directly related to my machine, but I’m not sure what other steps I could take. I’ve tried everything from re-installing the plugin to completely re-installing my IDE as a fresh installation without a backup. I’m grateful that at least one version is still working for me 10.12.0.79769 but I would like to update from this eventually as I’m sure there has been growing improvements to the plugin since this version.

Hello @Antonio_Magallon,

I took the thread over from Tobi. I started investigations but I will need a bit more time. Here is what I can share so far:

  • the real reason why the DLL is not loaded is hidden, a trace is missing. I need to figure out why
  • the only thing that comes to my mind is that a security software is messing up. Do you have an antivirus software installed? Would you have a way to turn it off on this specific folder?

Hi Damien,

Yes, this is a work machine that has Bitdefender installed on it. I myself don’t have a means to disable it or to add any rules omitting the sonarlint folder. I’ve reached out to our security team to request a rule be added, though to see if this resovles the issue.

Hello @Antonio_Magallon,

I prepared a version that has more logs enabled. You can download it here.

Please make sure to:

  • uninstall your current version
  • install this build following these instructions
  • restart the IDE
  • send us logs from the startup until the error

Looking at the code, it really seems to be related to the loading of the assembly, that is normally extracted just before. So I suspect a security software is messing with the newly created file, maybe analyzing it for a short while and making it unreadable during this time.

Let me know if you were able to disable it on your side.
Tahnks

1 Like

Thanks Damien.

Naturally, I installed the version you provided, and now the issue seems to be resolved :sweat_smile:. I’ve still uploaded the logs for you, just in case they provide some helpful data. These are the standard logs, not with verbose output or analysis logs options enabled.

This did get me curious if this issue was resolved with a recent version or if whatever plague my machine was suffering had miraculously stopped. I installed a few of the latest versions of the plugin and found that with two latest versions, I wasn’t able to reproduce the issues. Those were versions 10.20.0.80985 and 10.19.0.80823. I was able to reproduce the issue though with some older versions. The latest version I was still able to reproduce the issue with was version 10.18.0.80657.

I should mention that me and another from my org’s help desk have been looking into this issue to see if there was something with the antivirus blocking the plugin. We had tried updating the policy to resolve the issue but had no success, so I’m not sure if I can say that updated policy had any effect to get these newer versions of the plugin working.

I’ll continue using the version you provided me with the extra logs though for the next few days just in case I do start to run into the issue again.

sonarlint-10_21_0_81034-log.txt (32.5 KB)

1 Like

I forgot to mention in my post but you needed to keep verbose output and analysis logs options enabled to see the new traces.

I’m really puzzled by your situation. In fact, I don’t know if it’s related to a particular version or if the problem randomly appears. For now I don’t have another explanation that Bitdefender messing up…

Please keep using this custom version with additional logs in case the problem manifests itself again. The only time at which it can happen is at startup

1 Like

@Damien_Urruty It’s been over a month since I’ve installed the updated version of SonarQube with the added logging and I haven’t had any failures yet. I think it’s safe to say that my issue was likely fixed in some update to the plugin OR something has changed on my workplace side with how our anti-virus works.

Either way, I think we’re good to close this ticket since there’s nothing further to dig into here. Thanks for your help and everyone else from the Sonarqube team for looking into this issue for me.

1 Like

Thanks for the update, I will mark this thread as resolved. Don’t hesitate to report back if you face the problem again