"Argument types do not match" when using ternary operator on Guids in Select statement #23802
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
Issue and Code
I'm pretty sure this is a similar issue to #23309 and #23556, but that's marked as fixed for 5.0.1, which we're already on. Similar to #23556, this came up right after we upgraded to EF Core 5 (from 3.1.3 -> 5.0.1)
Basically, this line in a select statement causes "Argument types do not match" to be thrown when
.ToList()
is called on the query:This is a significantly-simplified version of the whole query:
The
ProviderID
property ofClaimViewModel
is a non-nullable Guid:public Guid ProviderID { get; set; }
. Bothsupervisor.SupervisorID
andprovider.ID
are also non-nullable Guids.In all cases,
provider.ID
will be set, guaranteed by the null check in thewhere
clause.Workaround
I can get everything to work properly by doing this in the
select
:However, I don't think that should be necessary. I figured it out by guessing based on the workaround found in #23556.
Stack trace
Provider and version information
EF Core version: 5.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Win 10 Pro (also on Azure App Service)
IDE: Visual Studio 2019 16.8.3
The text was updated successfully, but these errors were encountered: