Skip to content

The EF Core package throws MissingMethodException on EF Core 11: ConverterMappingHints lost its value-generator parameter #285

Backlog

Description

@CaffeinatedCoder

Package

CodoMetis.TypeKit.EntityFrameworkCore

Version

2.3.1 from nuget.org. release/2.4.0 has the same line (ValueObjectMapping.cs:77), so it is in 2.4.0 as it stands.

How does it fail?

Loudly, but only at run time. Restore and build are clean: the package asks for Microsoft.EntityFrameworkCore.Relational 10.0.12 or later with no ceiling, so NuGet takes 11.0.0 without a warning (no NU1605, no NU1608). The first value object EF maps then throws.

What you ran

A net11.0 console project, measured 2026-11-28:

<PackageReference Include="CodoMetis.TypeKit" Version="2.3.1" />
<PackageReference Include="CodoMetis.TypeKit.Generators" Version="2.3.1" />
<PackageReference Include="CodoMetis.TypeKit.EntityFrameworkCore" Version="2.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="11.0.0" />
var options = new DbContextOptionsBuilder<Db>().UseSqlite(connection).UseTypeKit().Options;
using var db = new Db(options);
db.Database.EnsureCreated();   // throws

public readonly partial record struct OrderId : IValue<Guid>;
public class Order { public required OrderId Id { get; init; } }

What you got

System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints..ctor(
    System.Nullable`1<Int32>, System.Nullable`1<Int32>, System.Nullable`1<Int32>, System.Nullable`1<Boolean>,
    System.Func`3<IProperty, IEntityType, ValueGenerator>)'.
   at CodoMetis.TypeKit.EntityFrameworkCore.ValueObjectMapping.Of`2..ctor()
   at CodoMetis.TypeKit.EntityFrameworkCore.ValueObjectMapping.Factory.Visit[TValueObject,T]()
   at CodoMetis.TypeKit.CompilerServices.GeneratedValueObjectAttribute`2.Accept[TResult](IValueObjectVisitor`1 visitor)
   at CodoMetis.TypeKit.EntityFrameworkCore.ValueObjectMapping.For(GeneratedValueObjectAttribute valueObject)
   at CodoMetis.TypeKit.EntityFrameworkCore.ValueObjectTypeMappingSourcePlugin.FindMapping(RelationalTypeMappingInfo& mappingInfo)

EF Core 11 removed the valueGeneratorFactory parameter of ConverterMappingHints' constructor, and the ValueGeneratorFactory property with it (read from the XML documentation files of 10.0.12 and 11.0.0: five parameters, then four). ValueObjectMapping.Of<,>'s constructor calls it for a temporary number, and the JIT resolves the call for every value object, so the wrapped type doesn't matter.

What you expected

Either the package runs on EF Core 11, or restore says it can't.

Who it reaches

Every application that has this package and moves to EF Core 11, which has been generally available since 2026-11-10. That includes every consumer of CodoMetis.ValueRanges.EFCore.PostgreSQL 11 and CodoMetis.EFCore.SchemaKit 11: both require EF Core 11, so neither can be installed beside this package today. CodoMetis.EFCore.SchemaKit's design note (section 11) expects NU1605 here; there is none.

What it means for 2.4.0

To decide

  1. Fix it only in 2.4.0 with the net11.0 asset, and until then say in the 2.3.x README that EF Core 11 isn't supported.
  2. A 2.3.2 that runs on both lines from one net10.0 build, without the removed constructor.
  3. A 2.3.2 that declares the ceiling, [10.0.12, 11.0.0), so restore refuses EF Core 11 where today the first query does.

Environment

macOS arm64, .NET SDK 11.0.100 (10.0.404 beside it), runtime 11.0.0, EF Core 11.0.0, Metalama 2026.1.30.

Activity

  1. added this to the 2.4.0 milestone on Nov 28, 2026
  2. added
    bug
    severity/high
    package/efcore
    area/release
    on Nov 28, 2026
  3. CaffeinatedCoder commented on Nov 28, 2026

    @CaffeinatedCoder
    OwnerAuthor

    State 2026-11-28. Fixed on the net11.0 asset. Local branch build/metalama-2027-preview (from release/2.4.0, with #282 merged in), not pushed on 2026-11-28.

    • The package and its tests target net10.0 and net11.0; the net11.0 group requires EF Core 11.0.0. One line did not compile against EF Core 11, the one in the stack trace above.
    • EF Core 11 removed decision 114's route altogether (the factory of ConverterMappingHints and of CoreTypeMapping, and the selector's read of it). With nothing in its place 18 key tests fail on net11.0. Decision 132 (new, on the branch): a value object over ulong or char generated on add gets WrappedTypeValueGeneratorFactory on the property. All key tests then pass on both targets.
    • What that changes on EF Core 11: SQL Server's HiLo is not chosen for a ulong key until the application clears the factory (one line, in the README, held by a test); a --nativeaot compiled model and a converter named by hand get the temporary value they lacked.
    • Not mergeable yet: 73 other tests fail on net11.0, which are net11.0: the EF Core satellite on EF Core 11 (nested complex keys, CAST stripping, primitive collections) #215's. The weaving review is not done.

    Of the three ways above, the maintainer chose the first on 2026-11-28: the fix ships in 2.4.0, whose previews build on the current Metalama 2027 preview (decision 130, on the branch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/releasebugpackage/efcoreseverity/high

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions