I found that I had the same error, and it occurred when I was using a Func<TEntity, bool>
instead of a Expression<Func<TEntity, bool>>
for your predicate
.
Once I changed out all Func's
to Expression's
the exception stopped being thrown.
I believe that EntityFramwork
does some clever things with Expression's
which it simply does not do with Func's