Skip to content

EF Core + SQL Server causes Roslyn error in .NET 9 project when used with Carter #377

@TanerSaydam

Description

@TanerSaydam

Summary

When I add EF Core (with SQL Server and Tools) to a .NET 9 project using Carter, I receive a Roslyn-related error when trying to run the application or generate migrations using Code First.

However, when I use only Microsoft.EntityFrameworkCore.InMemory, everything works fine.

Reproduction Steps

  1. Create a new .NET 9 minimal API project.
  2. Add Carter.
  3. Add the following packages:
    • Microsoft.EntityFrameworkCore.SqlServer (tried both 9.0.7 and 9.0.0)
    • Microsoft.EntityFrameworkCore.Tools
  4. Try to run the project or execute dotnet ef migrations add InitialCreate.

Error Output

Unable to load one or more of the requested types.
Method 'get_IsParamsArray' in type 'Microsoft.CodeAnalysis.CodeGeneration.CodeGenerationParameterSymbol' from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
Method 'get_PartialDefinitionPart' in type 'Microsoft.CodeAnalysis.CodeGeneration.CodeGenerationPropertySymbol' from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
Method 'get_AllowsRefLikeType' in type 'Microsoft.CodeAnalysis.CodeGeneration.CodeGenerationTypeParameterSymbol' from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions