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 types in exception message for EF.Default failure #28922

Open
ajcvickers opened this issue Aug 30, 2022 · 0 comments
Open

Include types in exception message for EF.Default failure #28922

ajcvickers opened this issue Aug 30, 2022 · 0 comments

Comments

@ajcvickers
Copy link
Contributor

See #28921

warn: 8/30/2022 18:22:48.438 RelationalEventId.QueryPossibleUnintendedUseOfEqualsWarning[20501] (Microsoft.EntityFrameworkCore.Query)
      Possible unintended use of method 'Equals' for arguments 'p.PublishedOn' and 'DEFAULT' of different types in a query. This comparison will always return false.
Unhandled exception. System.InvalidOperationException: The LINQ expression 'DbSet<FeaturedPost>()
    .ExecuteUpdate(setPropertyCalls => setPropertyCalls.SetProperty<DateTime>(
        propertyExpression: post => post.PublishedOn,
        valueExpression: post => EF.Default<DateTime>()))' could not be translated. Additional information: The following 'SetProperty' failed to translate: 'SetProperty(post => post.PublishedOn, post => EF.Default<DateTime>())'.  See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.RelationalQueryableExtensions.ExecuteUpdateAsync[TSource](IQueryable`1 source, Expression`1 setPropertyCalls, CancellationToken cancellationToken)
   at NewInEfCore7.ExecuteUpdateSample.ResetPostPublishedOnToDefault[TContext]() in C:\github\EntityFramework.Docs\samples\core\Miscellaneous\NewInEFCore7\ExecuteUpdateSample.cs:line 182
   at NewInEfCore7.ExecuteUpdateSample.ResetPostPublishedOnToDefault[TContext]() in C:\github\EntityFramework.Docs\samples\core\Miscellaneous\NewInEFCore7\ExecuteUpdateSample.cs:line 191
   at NewInEfCore7.ExecuteUpdateSample.ExecuteUpdateTest[TContext]() in C:\github\EntityFramework.Docs\samples\core\Miscellaneous\NewInEFCore7\ExecuteUpdateSample.cs:line 59
   at NewInEfCore7.ExecuteUpdateSample.ExecuteUpdateTest[TContext]() in C:\github\EntityFramework.Docs\samples\core\Miscellaneous\NewInEFCore7\ExecuteUpdateSample.cs:line 61
   at Program.Main() in C:\github\EntityFramework.Docs\samples\core\Miscellaneous\NewInEFCore7\Program.cs:line 18
   at Program.<Main>()
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

1 participant