From 407c68d6ba25d7c8e6e4eb1235ddaca47586c373 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Sun, 16 Nov 2025 12:59:32 +0100 Subject: [PATCH 1/2] Handle .NET 10 MemoryExtensions.Contains overload with comparer Fixes #37176 --- .../Internal/ExpressionTreeFuncletizer.cs | 58 +++++++++++++++---- .../PrimitiveCollectionsQueryTestBase.cs | 28 +++++++++ ...imitiveCollectionsQueryOldSqlServerTest.cs | 39 +++++++++++++ ...imitiveCollectionsQuerySqlServer160Test.cs | 39 +++++++++++++ ...veCollectionsQuerySqlServerJsonTypeTest.cs | 39 +++++++++++++ .../PrimitiveCollectionsQuerySqlServerTest.cs | 39 +++++++++++++ .../PrimitiveCollectionsQuerySqliteTest.cs | 39 +++++++++++++ 7 files changed, 271 insertions(+), 10 deletions(-) diff --git a/src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs b/src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs index eb02e70da83..95fa51cb9be 100644 --- a/src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs +++ b/src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs @@ -115,6 +115,9 @@ public class ExpressionTreeFuncletizer : ExpressionVisitor private static readonly bool UseOldBehavior35100 = AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue35100", out var enabled35100) && enabled35100; + private static readonly bool UseOldBehavior37176 = + AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue37176", out var enabled37176) && enabled37176; + private static readonly MethodInfo ReadOnlyCollectionIndexerGetter = typeof(ReadOnlyCollection).GetProperties() .Single(p => p.GetIndexParameters() is { Length: 1 } indexParameters && indexParameters[0].ParameterType == typeof(int)).GetMethod!; @@ -985,7 +988,9 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCall) switch (method.Name) { case nameof(MemoryExtensions.Contains) - when methodCall.Arguments is [var arg0, var arg1] && TryUnwrapSpanImplicitCast(arg0, out var unwrappedArg0): + when UseOldBehavior37176 + && methodCall.Arguments is [var arg0, var arg1] + && TryUnwrapSpanImplicitCast(arg0, out var unwrappedArg0): { return Visit( Call( @@ -993,6 +998,22 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCall) unwrappedArg0, arg1)); } + // In .NET 10, MemoryExtensions.Contains has an overload that accepts a third, optional comparer, in addition to the older + // overload that accepts two parameters only. + case nameof(MemoryExtensions.Contains) + when !UseOldBehavior37176 + && methodCall.Arguments is [var spanArg, var valueArg, ..] + && (methodCall.Arguments.Count is 2 + || methodCall.Arguments.Count is 3 + && methodCall.Arguments[2] is ConstantExpression { Value: null }) + && TryUnwrapSpanImplicitCast(spanArg, out var unwrappedSpanArg): + { + return Visit( + Call( + EnumerableMethods.Contains.MakeGenericMethod(method.GetGenericArguments()[0]), + unwrappedSpanArg, valueArg)); + } + case nameof(MemoryExtensions.SequenceEqual) when methodCall.Arguments is [var arg0, var arg1] && TryUnwrapSpanImplicitCast(arg0, out var unwrappedArg0) @@ -1005,20 +1026,37 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCall) static bool TryUnwrapSpanImplicitCast(Expression expression, [NotNullWhen(true)] out Expression? result) { - if (expression is MethodCallExpression + switch (expression) + { + // With newer versions of the SDK, the implicit cast is represented as a MethodCallExpression; + // with older versions, it's a Convert node. + case MethodCallExpression { Method: { Name: "op_Implicit", DeclaringType: { IsGenericType: true } implicitCastDeclaringType }, Arguments: [var unwrapped] + } when implicitCastDeclaringType.GetGenericTypeDefinition() is var genericTypeDefinition + && (genericTypeDefinition == typeof(Span<>) || genericTypeDefinition == typeof(ReadOnlySpan<>)): + { + result = unwrapped; + return true; } - && implicitCastDeclaringType.GetGenericTypeDefinition() is var genericTypeDefinition - && (genericTypeDefinition == typeof(Span<>) || genericTypeDefinition == typeof(ReadOnlySpan<>))) - { - result = unwrapped; - return true; - } - result = null; - return false; + case UnaryExpression + { + NodeType: ExpressionType.Convert, + Operand: var unwrapped, + Type: { IsGenericType: true } convertType + } when !UseOldBehavior37176 && convertType.GetGenericTypeDefinition() is var genericTypeDefinition + && (genericTypeDefinition == typeof(Span<>) || genericTypeDefinition == typeof(ReadOnlySpan<>)): + { + result = unwrapped; + return true; + } + + default: + result = null; + return false; + } } } diff --git a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs index 60e7cd24697..10bc9225e49 100644 --- a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs @@ -607,6 +607,34 @@ public virtual Task Column_collection_of_bools_Contains(bool async) async, ss => ss.Set().Where(c => c.Bools.Contains(true))); + // C# 14 first-class spans caused MemoryExtensions.Contains to get resolved instead of Enumerable.Contains. + // The following tests that the various overloads are all supported. + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Contains_on_Enumerable(bool async) + => AssertQuery( + async, + ss => ss.Set().Where(c => Enumerable.Contains(new[] { 10, 999 }, c.Int))); + + // C# 14 first-class spans caused MemoryExtensions.Contains to get resolved instead of Enumerable.Contains. + // The following tests that the various overloads are all supported. + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Contains_on_MemoryExtensions(bool async) + => AssertQuery( + async, + ss => ss.Set().Where(c => MemoryExtensions.Contains(new[] { 10, 999 }, c.Int))); + + // Note that we don't test EF 8/9 with .NET 10; this test is here for completeness/documentation purposes. +#if NET10_0_OR_GREATER + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + => AssertQuery( + async, + ss => ss.Set().Where(c => MemoryExtensions.Contains(new[] { 10, 999 }, c.Int, comparer: null))); +#endif + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Column_collection_Count_method(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs index 1041c1e10c1..a492f97fd88 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs @@ -761,6 +761,45 @@ await context.Database.SqlQuery($"SELECT [Bools] AS [Value] FROM [Primit .SingleAsync()); } + public override async Task Contains_on_Enumerable(bool async) + { + await base.Contains_on_Enumerable(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + + + public override async Task Contains_on_MemoryExtensions(bool async) + { + await base.Contains_on_MemoryExtensions(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + +#if NET10_0_OR_GREATER + public override async Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + { + await base.Contains_with_MemoryExtensions_with_null_comparer(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } +#endif + public override Task Column_collection_Count_method(bool async) => AssertCompatibilityLevelTooLow(() => base.Column_collection_Count_method(async)); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs index 9aea6357ba3..186799afd4e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs @@ -955,6 +955,45 @@ await context.Database.SqlQuery($"SELECT [Bools] AS [Value] FROM [Primit .SingleAsync()); } + public override async Task Contains_on_Enumerable(bool async) + { + await base.Contains_on_Enumerable(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + + + public override async Task Contains_on_MemoryExtensions(bool async) + { + await base.Contains_on_MemoryExtensions(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + +#if NET10_0_OR_GREATER + public override async Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + { + await base.Contains_with_MemoryExtensions_with_null_comparer(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } +#endif + public override async Task Column_collection_Count_method(bool async) { await base.Column_collection_Count_method(async); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs index 29656d04fe6..0e27003a1e2 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs @@ -929,6 +929,45 @@ await context.Database.SqlQuery($"SELECT [Bools] AS [Value] FROM [Primit .SingleAsync()); } + public override async Task Contains_on_Enumerable(bool async) + { + await base.Contains_on_Enumerable(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + + + public override async Task Contains_on_MemoryExtensions(bool async) + { + await base.Contains_on_MemoryExtensions(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + +#if NET10_0_OR_GREATER + public override async Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + { + await base.Contains_with_MemoryExtensions_with_null_comparer(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } +#endif + public override async Task Column_collection_Count_method(bool async) { await base.Column_collection_Count_method(async); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs index 0708539aaa5..ed20eb7db20 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs @@ -978,6 +978,45 @@ await context.Database.SqlQuery($"SELECT [Bools] AS [Value] FROM [Primit .SingleAsync()); } + public override async Task Contains_on_Enumerable(bool async) + { + await base.Contains_on_Enumerable(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + + + public override async Task Contains_on_MemoryExtensions(bool async) + { + await base.Contains_on_MemoryExtensions(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } + +#if NET10_0_OR_GREATER + public override async Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + { + await base.Contains_with_MemoryExtensions_with_null_comparer(async); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +"""); + } +#endif + public override async Task Column_collection_Count_method(bool async) { await base.Column_collection_Count_method(async); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs index 58b6bb73a75..68a914a22c5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs @@ -957,6 +957,45 @@ FROM json_each("p"."Bools") AS "b" """); } + public override async Task Contains_on_Enumerable(bool async) + { + await base.Contains_on_Enumerable(async); + + AssertSql( + """ +SELECT "p"."Id", "p"."Bool", "p"."Bools", "p"."DateTime", "p"."DateTimes", "p"."Enum", "p"."Enums", "p"."Int", "p"."Ints", "p"."NullableInt", "p"."NullableInts", "p"."NullableString", "p"."NullableStrings", "p"."String", "p"."Strings" +FROM "PrimitiveCollectionsEntity" AS "p" +WHERE "p"."Int" IN (10, 999) +"""); + } + + + public override async Task Contains_on_MemoryExtensions(bool async) + { + await base.Contains_on_MemoryExtensions(async); + + AssertSql( + """ +SELECT "p"."Id", "p"."Bool", "p"."Bools", "p"."DateTime", "p"."DateTimes", "p"."Enum", "p"."Enums", "p"."Int", "p"."Ints", "p"."NullableInt", "p"."NullableInts", "p"."NullableString", "p"."NullableStrings", "p"."String", "p"."Strings" +FROM "PrimitiveCollectionsEntity" AS "p" +WHERE "p"."Int" IN (10, 999) +"""); + } + +#if NET10_0_OR_GREATER + public override async Task Contains_with_MemoryExtensions_with_null_comparer(bool async) + { + await base.Contains_with_MemoryExtensions_with_null_comparer(async); + + AssertSql( + """ +SELECT "p"."Id", "p"."Bool", "p"."Bools", "p"."DateTime", "p"."DateTimes", "p"."Enum", "p"."Enums", "p"."Int", "p"."Ints", "p"."NullableInt", "p"."NullableInts", "p"."NullableString", "p"."NullableStrings", "p"."String", "p"."Strings" +FROM "PrimitiveCollectionsEntity" AS "p" +WHERE "p"."Int" IN (10, 999) +"""); + } +#endif + public override async Task Column_collection_Count_method(bool async) { await base.Column_collection_Count_method(async); From a78695b2ff4a0587b9112a5786d163972b872047 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Mon, 17 Nov 2025 12:24:57 +0100 Subject: [PATCH 2/2] Temporarily test EF9 with net10.0 --- global.json | 2 +- src/Shared/EnumerableExtensions.cs | 24 ++++++++-------- .../EFCore.Analyzers.Tests.csproj | 2 +- ...ore.AspNet.InMemory.FunctionalTests.csproj | 2 +- .../EFCore.AspNet.Specification.Tests.csproj | 2 +- ...re.AspNet.SqlServer.FunctionalTests.csproj | 2 +- ...FCore.AspNet.Sqlite.FunctionalTests.csproj | 2 +- .../EFCore.Cosmos.FunctionalTests.csproj | 2 +- .../EFCore.Cosmos.Tests.csproj | 2 +- .../EFCore.CrossStore.FunctionalTests.csproj | 2 +- .../EFCore.Design.Tests.csproj | 2 +- .../EFCore.InMemory.FunctionalTests.csproj | 2 +- .../EFCore.InMemory.Tests.csproj | 2 +- .../EFCore.OData.FunctionalTests.csproj | 2 +- .../EFCore.Proxies.Tests.csproj | 2 +- ...Core.Relational.Specification.Tests.csproj | 2 +- .../EFCore.Relational.Tests.csproj | 2 +- .../EFCore.Specification.Tests.csproj | 2 +- .../EFCore.SqlServer.FunctionalTests.csproj | 2 +- .../EFCore.SqlServer.HierarchyId.Tests.csproj | 2 +- .../EFCore.SqlServer.Tests.csproj | 2 +- .../EFCore.Sqlite.FunctionalTests.csproj | 2 +- .../EFCore.Sqlite.Tests.csproj | 2 +- test/EFCore.Tests/EFCore.Tests.csproj | 2 +- test/EFCore.Tests/EFTest.cs | 28 +++++++++---------- .../EFCore.VisualBasic.FunctionalTests.vbproj | 2 +- 26 files changed, 50 insertions(+), 50 deletions(-) diff --git a/global.json b/global.json index e428a94ebb9..ae5f5aff6cc 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.110", + "version": "10.0.100", "allowPrerelease": true, "rollForward": "latestMajor" }, diff --git a/src/Shared/EnumerableExtensions.cs b/src/Shared/EnumerableExtensions.cs index 282b1ddce96..6a497dd89f5 100644 --- a/src/Shared/EnumerableExtensions.cs +++ b/src/Shared/EnumerableExtensions.cs @@ -125,18 +125,18 @@ public static bool Any(this IEnumerable source) return false; } - public static async Task> ToListAsync( - this IAsyncEnumerable source, - CancellationToken cancellationToken = default) - { - var list = new List(); - await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) - { - list.Add(element); - } - - return list; - } + // public static async Task> ToListAsync( + // this IAsyncEnumerable source, + // CancellationToken cancellationToken = default) + // { + // var list = new List(); + // await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) + // { + // list.Add(element); + // } + + // return list; + // } public static List ToList(this IEnumerable source) => source.OfType().ToList(); diff --git a/test/EFCore.Analyzers.Tests/EFCore.Analyzers.Tests.csproj b/test/EFCore.Analyzers.Tests/EFCore.Analyzers.Tests.csproj index 2c3875c95d3..1042f32036f 100644 --- a/test/EFCore.Analyzers.Tests/EFCore.Analyzers.Tests.csproj +++ b/test/EFCore.Analyzers.Tests/EFCore.Analyzers.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Analyzers.Tests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.AspNet.InMemory.FunctionalTests/EFCore.AspNet.InMemory.FunctionalTests.csproj b/test/EFCore.AspNet.InMemory.FunctionalTests/EFCore.AspNet.InMemory.FunctionalTests.csproj index abffdd03822..0078bb7aea1 100644 --- a/test/EFCore.AspNet.InMemory.FunctionalTests/EFCore.AspNet.InMemory.FunctionalTests.csproj +++ b/test/EFCore.AspNet.InMemory.FunctionalTests/EFCore.AspNet.InMemory.FunctionalTests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.AspNet.InMemory.FunctionalTests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj b/test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj index 3ea53b38ea8..5a7d542d7c5 100644 --- a/test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj +++ b/test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj @@ -2,7 +2,7 @@ Shared ASP.NET test suite for Entity Framework Core database providers. - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.AspNet.Specification.Tests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.AspNet.SqlServer.FunctionalTests/EFCore.AspNet.SqlServer.FunctionalTests.csproj b/test/EFCore.AspNet.SqlServer.FunctionalTests/EFCore.AspNet.SqlServer.FunctionalTests.csproj index 9a527a88ac1..84f328ef72f 100644 --- a/test/EFCore.AspNet.SqlServer.FunctionalTests/EFCore.AspNet.SqlServer.FunctionalTests.csproj +++ b/test/EFCore.AspNet.SqlServer.FunctionalTests/EFCore.AspNet.SqlServer.FunctionalTests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.AspNet.SqlServer.FunctionalTests Microsoft.EntityFrameworkCore True diff --git a/test/EFCore.AspNet.Sqlite.FunctionalTests/EFCore.AspNet.Sqlite.FunctionalTests.csproj b/test/EFCore.AspNet.Sqlite.FunctionalTests/EFCore.AspNet.Sqlite.FunctionalTests.csproj index 9c670219fb4..a27bd98867a 100644 --- a/test/EFCore.AspNet.Sqlite.FunctionalTests/EFCore.AspNet.Sqlite.FunctionalTests.csproj +++ b/test/EFCore.AspNet.Sqlite.FunctionalTests/EFCore.AspNet.Sqlite.FunctionalTests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.AspNet.Sqlite.FunctionalTests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj b/test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj index 5be9cabc700..46a23d152ba 100644 --- a/test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj +++ b/test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Cosmos.FunctionalTests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.Cosmos.Tests/EFCore.Cosmos.Tests.csproj b/test/EFCore.Cosmos.Tests/EFCore.Cosmos.Tests.csproj index 949d9872ac9..fdb9d5c08d1 100644 --- a/test/EFCore.Cosmos.Tests/EFCore.Cosmos.Tests.csproj +++ b/test/EFCore.Cosmos.Tests/EFCore.Cosmos.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Cosmos.Tests Microsoft.EntityFrameworkCore.Cosmos disable diff --git a/test/EFCore.CrossStore.FunctionalTests/EFCore.CrossStore.FunctionalTests.csproj b/test/EFCore.CrossStore.FunctionalTests/EFCore.CrossStore.FunctionalTests.csproj index b54afbfe885..fe59a372721 100644 --- a/test/EFCore.CrossStore.FunctionalTests/EFCore.CrossStore.FunctionalTests.csproj +++ b/test/EFCore.CrossStore.FunctionalTests/EFCore.CrossStore.FunctionalTests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.CrossStore.FunctionalTests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Design.Tests/EFCore.Design.Tests.csproj b/test/EFCore.Design.Tests/EFCore.Design.Tests.csproj index 9d4ed03c0fe..d210306fd3a 100644 --- a/test/EFCore.Design.Tests/EFCore.Design.Tests.csproj +++ b/test/EFCore.Design.Tests/EFCore.Design.Tests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 true Microsoft.EntityFrameworkCore.Design.Tests Microsoft.EntityFrameworkCore diff --git a/test/EFCore.InMemory.FunctionalTests/EFCore.InMemory.FunctionalTests.csproj b/test/EFCore.InMemory.FunctionalTests/EFCore.InMemory.FunctionalTests.csproj index b630896bc90..ea5d4f16930 100644 --- a/test/EFCore.InMemory.FunctionalTests/EFCore.InMemory.FunctionalTests.csproj +++ b/test/EFCore.InMemory.FunctionalTests/EFCore.InMemory.FunctionalTests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.InMemory.FunctionalTests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.InMemory.Tests/EFCore.InMemory.Tests.csproj b/test/EFCore.InMemory.Tests/EFCore.InMemory.Tests.csproj index 571d2db3518..44036f0ab37 100644 --- a/test/EFCore.InMemory.Tests/EFCore.InMemory.Tests.csproj +++ b/test/EFCore.InMemory.Tests/EFCore.InMemory.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.InMemory.Tests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.OData.FunctionalTests/EFCore.OData.FunctionalTests.csproj b/test/EFCore.OData.FunctionalTests/EFCore.OData.FunctionalTests.csproj index 1778dd946d9..c6d6261c731 100644 --- a/test/EFCore.OData.FunctionalTests/EFCore.OData.FunctionalTests.csproj +++ b/test/EFCore.OData.FunctionalTests/EFCore.OData.FunctionalTests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.OData.FunctionalTests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Proxies.Tests/EFCore.Proxies.Tests.csproj b/test/EFCore.Proxies.Tests/EFCore.Proxies.Tests.csproj index bc7ecf3deee..2b2b27e20f5 100644 --- a/test/EFCore.Proxies.Tests/EFCore.Proxies.Tests.csproj +++ b/test/EFCore.Proxies.Tests/EFCore.Proxies.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Proxies.Tests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Relational.Specification.Tests/EFCore.Relational.Specification.Tests.csproj b/test/EFCore.Relational.Specification.Tests/EFCore.Relational.Specification.Tests.csproj index d88c0787094..2a798b56744 100644 --- a/test/EFCore.Relational.Specification.Tests/EFCore.Relational.Specification.Tests.csproj +++ b/test/EFCore.Relational.Specification.Tests/EFCore.Relational.Specification.Tests.csproj @@ -2,7 +2,7 @@ Shared test suite for Entity Framework Core relational database providers. - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Relational.Specification.Tests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj b/test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj index 2c14c5d40b9..31517328fde 100644 --- a/test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj +++ b/test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Relational.Tests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj b/test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj index 43c4f24085a..c01839ae0b8 100644 --- a/test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj +++ b/test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj @@ -2,7 +2,7 @@ Shared test suite for Entity Framework Core database providers. - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Specification.Tests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj b/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj index d91e7e88ddf..b73f729f364 100644 --- a/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj +++ b/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.SqlServer.FunctionalTests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.SqlServer.HierarchyId.Tests/EFCore.SqlServer.HierarchyId.Tests.csproj b/test/EFCore.SqlServer.HierarchyId.Tests/EFCore.SqlServer.HierarchyId.Tests.csproj index e6d23444287..cdc9680fa87 100644 --- a/test/EFCore.SqlServer.HierarchyId.Tests/EFCore.SqlServer.HierarchyId.Tests.csproj +++ b/test/EFCore.SqlServer.HierarchyId.Tests/EFCore.SqlServer.HierarchyId.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.SqlServer.HierarchyId.Tests Microsoft.EntityFrameworkCore.SqlServer disable diff --git a/test/EFCore.SqlServer.Tests/EFCore.SqlServer.Tests.csproj b/test/EFCore.SqlServer.Tests/EFCore.SqlServer.Tests.csproj index 3d973b54271..36d4b68951b 100644 --- a/test/EFCore.SqlServer.Tests/EFCore.SqlServer.Tests.csproj +++ b/test/EFCore.SqlServer.Tests/EFCore.SqlServer.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.SqlServer.Tests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj b/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj index 1279a7b59b3..1a46d53476c 100644 --- a/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj +++ b/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj @@ -1,7 +1,7 @@ - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Sqlite.FunctionalTests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.Sqlite.Tests/EFCore.Sqlite.Tests.csproj b/test/EFCore.Sqlite.Tests/EFCore.Sqlite.Tests.csproj index 749df3766b1..d1455fb03ff 100644 --- a/test/EFCore.Sqlite.Tests/EFCore.Sqlite.Tests.csproj +++ b/test/EFCore.Sqlite.Tests/EFCore.Sqlite.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Sqlite.Tests Microsoft.EntityFrameworkCore true diff --git a/test/EFCore.Tests/EFCore.Tests.csproj b/test/EFCore.Tests/EFCore.Tests.csproj index aa6260f3e87..47045b965b0 100644 --- a/test/EFCore.Tests/EFCore.Tests.csproj +++ b/test/EFCore.Tests/EFCore.Tests.csproj @@ -1,7 +1,7 @@  - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.Tests Microsoft.EntityFrameworkCore disable diff --git a/test/EFCore.Tests/EFTest.cs b/test/EFCore.Tests/EFTest.cs index 5c33f63a5c4..ea9b3cce092 100644 --- a/test/EFCore.Tests/EFTest.cs +++ b/test/EFCore.Tests/EFTest.cs @@ -31,24 +31,24 @@ public void CompiledQuery_throws_when_used_with_different_models() _ = query(context1, new Bar()).ToList(); } - [ConditionalFact] - public async Task CompiledQueryAsync_throws_when_used_with_different_models() - { - using var context1 = new SwitchContext(); - using var context2 = new SwitchContext(); + // [ConditionalFact] + // public async Task CompiledQueryAsync_throws_when_used_with_different_models() + // { + // using var context1 = new SwitchContext(); + // using var context2 = new SwitchContext(); - var query = EF.CompileAsyncQuery((SwitchContext c) => c.Foos); + // var query = EF.CompileAsyncQuery((SwitchContext c) => c.Foos); - _ = await query(context1).ToListAsync(); - _ = await query(context1).ToListAsync(); + // _ = await query(context1).ToListAsync(); + // _ = await query(context1).ToListAsync(); - Assert.Equal( - CoreStrings.CompiledQueryDifferentModel("c => c.Foos"), - (await Assert.ThrowsAsync( - () => query(context2).ToListAsync())).Message); + // Assert.Equal( + // CoreStrings.CompiledQueryDifferentModel("c => c.Foos"), + // (await Assert.ThrowsAsync( + // () => query(context2).ToListAsync())).Message); - _ = await query(context1).ToListAsync(); - } + // _ = await query(context1).ToListAsync(); + // } private class Foo { diff --git a/test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj b/test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj index 6b860b8698c..3ca6264b7b4 100644 --- a/test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj +++ b/test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj @@ -2,7 +2,7 @@ Microsoft.EntityFrameworkCore - $(DefaultNetCoreTargetFramework) + net10.0 Microsoft.EntityFrameworkCore.VisualBasic.FunctionalTests True latest