Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using new[] in select query gives exception .NET 8 #32331

Copy link
Copy link

Description

@Ogglas
Issue body actions

File a bug

Include your code

I could not find anything about this and therefore decided to post this.

This code worked with .NET 7 and Microsoft.EntityFrameworkCore.SqlServer Version 7.0.13:

Updated = p.ThreatAndCountermeasures.Count() > 0 ? new[] { p.Updated, p.ThreatAndCountermeasures.Max(tac => tac.Updated) }.Max() : p.Updated,

With .NET 8 and Microsoft.EntityFrameworkCore.SqlServer Version 8.0.0 I get the following exception:

Query root of type 'InlineQueryRootExpression' wasn't handled by provider code. This issue happens when using a provider specific method on a different provider where it is not supported.

If I use this code it works:

Updated = p.ThreatAndCountermeasures.Count() > 0 ? new List<DateTime> { p.Updated, p.ThreatAndCountermeasures.Max(tac => tac.Updated) }.Max() : p.Updated,

https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/breaking-changes

Include provider and version information

EF Core version: 8.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 8.0
Operating system: Windows 11 Pro OS build 22621.2506
IDE: Microsoft Visual Studio 2022 (64-bit) - Current Version 17.8.0

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.