Skip to content

MEF Composition Failure between C# Dev Kit and Copilot on macOS with .NET 9 SDK #8707

@honkbert

Description

@honkbert

System Details:

OS: macOS 15.7 (Apple Silicon)
.NET SDKs Installed: 8.0.414, 9.0.306
VS Code Version: 1.105.1 (and VS Code Insiders)
Extension Versions:

C# Dev Kit: v1.71.4
C#: v2.94.41
GitHub Copilot: v1.372.0
Problem Description:
The C# Language Server fails to compose correctly when both the C# Dev Kit and GitHub Copilot extensions are enabled. This results in multiple Microsoft.VisualStudio.Composition.CompositionFailedException errors in the C# Output log, specifically related to missing exports for Copilot and Pythia components.

While core language server features and debugging appear to function, advanced features are likely broken, and the log is filled with errors.

Steps to Reproduce:

On a clean macOS environment with both .NET 8 and .NET 9 SDKs installed.
Install VS Code or VS Code Insiders.
Install the ms-dotnettools.csdevkit, visualstudiotoolsforunity.vstuc, and github.copilot extensions.
Open a Unity project.
Observe the C# Output panel.
Expected Behavior:
The C# language server should start without any MEF composition errors.

Actual Behavior:
The C# language server logs multiple MEF composition failures, as shown below. This issue is reproducible even after a complete "deep clean" of all extension files and caches, and also occurs in a fresh installation of VS Code Insiders.

Log Output:
fail: Microsoft.CodeAnalysis.Remote.ExportProviderBuilder[0]
Encountered errors in the MEF composition:
----- CompositionError level 1 ------
Microsoft.CodeAnalysis.ExternalAccess.Copilot.Internal.SemanticSearch.CopilotSemanticSearchQueryExecutor.ctor(workspaceProvider): expected exactly 1 export matching constraints:
Contract name: Microsoft.CodeAnalysis.Host.IHostWorkspaceProvider
TypeIdentityName: Microsoft.CodeAnalysis.Host.IHostWorkspaceProvider
but found 0.
part definition Microsoft.CodeAnalysis.ExternalAccess.Copilot.Internal.SemanticSearch.CopilotSemanticSearchQueryExecutor

  Microsoft.CodeAnalysis.ExternalAccess.Pythia.PythiaSignatureHelpProvider.ctor(implementation): expected exactly 1 export matching constraints:
      Contract name: Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api.IPythiaSignatureHelpProviderImplementation
      TypeIdentityName: Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api.IPythiaSignatureHelpProviderImplementation
  but found 0.
     part definition Microsoft.CodeAnalysis.ExternalAccess.Pythia.PythiaSignatureHelpProvider
  
  Microsoft.VisualStudio.Copilot.Roslyn.Completion.CSharpReferencedSymbolDefinitionSnippetProvider.ctor(joinableTaskContext): expected exactly 1 export matching constraints:
      Contract name: Microsoft.VisualStudio.Threading.JoinableTaskContext
      TypeIdentityName: Microsoft.VisualStudio.Threading.JoinableTaskContext
  but found 0.
     part definition Microsoft.VisualStudio.Copilot.Roslyn.Completion.CSharpReferencedSymbolDefinitionSnippetProvider
  
  Microsoft.VisualStudio.Composition.CompositionFailedException: Errors exist in the composition.
     at Microsoft.VisualStudio.Composition.CompositionConfiguration.ThrowOnErrors()
     at Microsoft.CodeAnalysis.Remote.ExportProviderBuilder.CheckForAndReportCompositionErrors(CompositionConfiguration configuration, ComposableCatalog catalog)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions