Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include details in Exception for "LINQ Expression could not be translated" errors. #21753

Closed
IronSean opened this issue Jul 23, 2020 · 2 comments

Comments

@IronSean
Copy link

EF Framework used to provide specific errors if an expression could not be translated. I you tried to do DateTime.Now - entity.Time > myTimespan it would give you an errors like "TimeSpan can not be translated using Linq-to-SQL"

EFCore seems to just give a generic "The LINQ Expression could not be translated" error, but no additional guidance on which part of the expression is causing the problem. This causes unnecessary confusion when trying to determine which part of a LINQ expression is causing the problem, and I could see it being unnecessarily difficult for a newer user without a deep understanding of what Linq-to-SQL does and does not support.

Perhaps an inner exception could be passed through on InnerException or a better explanation message should be surfaced another way to describe the exact statements that are unable to be translated.

@ajcvickers
Copy link
Contributor

Duplicate of #20344. EF Core 5.0 already throws better messages for common cases where a query cannot be translated, and we are open to adding more.

@smitpatel
Copy link
Contributor

Filed #21762 for some cases. Which covers basic case mentioned above about DateTime - TimeSpan translation.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants