When using "this" in LINQ: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Wain123
Posts: 12
Joined: Wed 07 Jun 2017 07:25

When using "this" in LINQ: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Wain123 » Wed 28 Jun 2017 11:57

The following code in my Blog entity:

Code: Select all

foreach (var x in Ctx.Posts.Where(z => z.Blog == this)) {
}
throws System.InvalidOperationException: 'The operands for operator 'Equal' do not match the parameters of method 'op_Equality'.'

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: When using "this" in LINQ: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Shalex » Fri 30 Jun 2017 11:20

Thank you for your report. We will investigate the issue and notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: When using "this" in LINQ: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Shalex » Fri 04 Aug 2017 16:04

The bug with comparison and binary operations in EF Core is fixed: viewtopic.php?f=1&t=35777.

Post Reply