Initialization failure after update of Visual Studio 2022

After updating to the most recent version of Visual Studio 2022 (v17.1.3) SonarLint(v6.1.0.45943) fails to initialize with the following error entry in the logs:

<entry>
    <record>553</record>
    <time>2022/04/08 06:42:33.283</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [IssueVizSecurityPackage]Source: &apos;Microsoft.VisualStudio.Composition&apos; Description: Expected 1 export(s) with contract name &quot;SonarLint.VisualStudio.Integration.ILogger&quot; but found 0 after applying applicable constraints.&#x000D;&#x000A;Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name &quot;SonarLint.VisualStudio.Integration.ILogger&quot; but found 0 after applying applicable constraints.&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()&#x000D;&#x000A;   at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()&#x000D;&#x000A;   at SonarLint.VisualStudio.IssueVisualization.Security.IssueVizSecurityPackage.&lt;InitializeAsync&gt;d__1.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)</description>
    <guid>{D7D54E08-45E1-49A6-AA53-AF1CFAA6EBDC}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
  </entry>

Hi @davidf. Welcome to the community.

That sounds like a problem with the local MEF cache for Visual Studio. Have you tried uninstalling and reinstalling the extension?

If that doesn’t work, you could try clearing the MEF cache using this extension. VS will automatically re-create it on restart.

Hi Duncan,
uninstalling/reinstalling the extension fixes the issue, thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.