efcore: Access to context bound variable can incorrectly be optimized out

Found investigating #9809. This should work:

modelBuilder
    .Entity<Report>()
    .HasQueryFilter(x => !x.IsDeleted && (IsModerated == null || IsModerated == x.IsModerated));

but the IsModerated == null part is optimized away.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@antonio-campagnaro It was fixed in the NuGet package versioned 2.0.1, which is part of the ASP.NET meta-package 2.0.3.

So what release of EF Core resolve this issue?