Skip to content

Running the EFCore.InMemory.FunctionalTests suite produces 22 errors in test cleanup #38558

Description

@ajcvickers
Test Method Cleanup Failure
System.Reflection.AmbiguousMatchException : Ambiguous match found for 'Microsoft.EntityFrameworkCore.ModelBuilding.ModelBuilderTest+ComplexCollectionTestBase Void Properties_can_have_provider_type_set()'.
   at System.DefaultBinder.FindMostDerivedNewSlotMeth(MethodBase[] match, Int32 cMatches)
   at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()

Affected methods include (non-exhaustive):

  • ModelBuilderTest+ComplexCollectionTestBase.Properties_can_have_provider_type_set
  • ModelBuilderTest+ComplexCollectionTestBase.Properties_can_have_non_generic_value_converter_set
  • ModelBuilderTest+ComplexCollectionTestBase.Properties_can_have_custom_type_value_converter_type_set
  • Same three methods on ComplexTypeTestBase and NonRelationshipTestBase
  • StringTranslationsTestBase<BasicTypesQueryInMemoryFixture>.Equals

Each of these test classes declares a public, parameterless test method that forwards to a differently-arity generic protected method of the same name, e.g. (test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonRelationship.cs):

public virtual void Properties_can_have_provider_type_set()
    => Properties_can_have_provider_type_set<byte[]>();

protected virtual void Properties_can_have_provider_type_set<TBytes>()
{ ... }

Two methods share the name Properties_can_have_provider_type_set, both with zero formal parameters, differing only in generic arity (0 vs 1). This pattern is long-standing in the test suite.

This appears to be a new failure surfaced by the recent upgrade to xUnit v3 / bump of Microsoft.DotNet.XUnitV3Extensions (see ec063d100f "Upgrade to XUnit v3"

EF Core version: current main (commit abad2bec8c)
Target framework: net11.0
Test runner: xUnit v3 (Microsoft.DotNet.XUnitV3Extensions 11.0.0-beta.26329.101)

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions