AD0001 errors: System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG

Please provide

  • Operating system: Windows 10 Pro 21H2
  • SonarLint plugin version: 6.8.0.53188
  • Language you’re coding in: C#
  • Is connected mode used: No:
  • Visual Studio 2022 17.4.0 Preview 1

Building the solution I’m working on results in over 150,000 AD0001 warnings that all include the below exception (albeit with slightly different call stacks).
I am seeing some Sonar Lint warnings produced, so it’s not as if it’s totally broken!
I’ve uninstalled/reinstalled SonarLint and the issue remains.
Any suggestions?

System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.CodeAnalysis.DefaultAnalyzerAssemblyLoader.DirectoryLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at SonarAnalyzer.Rules.CSharp.FieldShouldBeReadonly.ReadonlyFieldCollector.PartialTypeDeclarationProcessor.TupleExpressionsOrSelf(ExpressionSyntax expression)
   at SonarAnalyzer.Rules.CSharp.FieldShouldBeReadonly.ReadonlyFieldCollector.PartialTypeDeclarationProcessor.CollectFieldsFromAssignments()
   at SonarAnalyzer.Rules.CSharp.FieldShouldBeReadonly.ReadonlyFieldCollector.PartialTypeDeclarationProcessor.CollectFields()
   at SonarAnalyzer.Rules.CSharp.FieldShouldBeReadonly.ReadonlyFieldCollector..ctor(IEnumerable`1 partialTypeDeclarations)
   at SonarAnalyzer.Rules.CSharp.FieldShouldBeReadonly.<>c.<Initialize>b__9_0(SymbolAnalysisContext c)
   at SonarAnalyzer.Helpers.SonarAnalysisContext.<>c__DisplayClass47_0`1.<RegisterContextAction>b__0(TContext c)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c.<ExecuteSymbolActionsCore>b__50_1(ValueTuple`2 data)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
-----
System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.CodeAnalysis.DefaultAnalyzerAssemblyLoader.DirectoryLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
-----
System.IO.FileNotFoundException: Could not load file or assembly 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'. The system cannot find the file specified.
File name: 'SonarAnalyzer.CFG, Version=8.44.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)

The issue has gone away after the update to Visual Studio Version 17.4.0 Preview 2.0 :slight_smile: