Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests do not compile because of new Contains overload with an optional argument #35547

Open
NikolaMilosavljevic opened this issue Jan 29, 2025 · 3 comments

Comments

@NikolaMilosavljevic
Copy link
Member

NikolaMilosavljevic commented Jan 29, 2025

Here are the errors encountered when we tried to enable building tests in VMR:

C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(23,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(30,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(406,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(409,68): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(420,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(423,68): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(625,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(689,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\PrimitiveCollectionsQueryTestBase.cs(696,67): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindWhereQueryTestBase.cs(1633,29): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindWhereQueryTestBase.cs(1707,29): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindAggregateOperatorsQueryTestBase.cs(950,49): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindAggregateOperatorsQueryTestBase.cs(956,49): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindAggregateOperatorsQueryTestBase.cs(1350,52): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\NorthwindAggregateOperatorsQueryTestBase.cs(1361,52): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]
C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\Query\GearsOfWarQueryTestBase.cs(5982,54): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\git\dotnet\src\efcore\test\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj]

For repro, add /p:DotNetBuildTests=true to your Windows VMR build command, i.e.: build -prepareMachine -c Release /p:TargetOS=windows /p:TargetArchitecture=x64 /bl /p:DotNetBuildTests=true

@roji
Copy link
Member

roji commented Jan 30, 2025

This is a result of dotnet/runtime#110197, which adds an overload of MemoryExtensions.Contains that has an optional comparer parameter, but expression trees do not support optional parameters (in this repo we haven't yet updated to a version of the SDK which has this).

I'll follow up on this in that issue.

roji added a commit to roji/efcore that referenced this issue Feb 2, 2025
Because of the new .NET Contains overload with an optional parameter,
which is incompatible with LINQ expression trees.

See dotnet#35547
roji added a commit to roji/efcore that referenced this issue Feb 2, 2025
Because of the new .NET Contains overload with an optional parameter,
which is incompatible with LINQ expression trees.

See dotnet#35547
@roji
Copy link
Member

roji commented Feb 2, 2025

FYI I've submitted #35569 to temporary comment out the problematic tests and allow EF to build with the latest SDK - until we decide how to properly fix the situation.

roji added a commit that referenced this issue Feb 3, 2025
Because of the new .NET Contains overload with an optional parameter,
which is incompatible with LINQ expression trees.

See #35547
@roji roji changed the title Numerous failures while building efcore tests in VMR Tests do not compile because of new Contains overload with an optional argument Feb 10, 2025
@roji roji added this to the 10.0.0 milestone Feb 10, 2025
@roji roji self-assigned this Feb 10, 2025
@roji roji added the blocked label Feb 10, 2025
@roji
Copy link
Member

roji commented Feb 10, 2025

Placing this in 10 as we'll need to find a solution to this (discussions are happening offline).

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

No branches or pull requests

2 participants