Base solution for your next web application
Open Closed

Getting error in every GetAll function after migrating to v8.0 #8016


User avatar
1
mujthabagroad created

Hi, After upgrading to newer version 8.0, getting an error in all menu which is generated with the RAD tool before.

ERROR 2019-11-14 15:04:01,086 [16   ] Mvc.ExceptionHandling.AbpExceptionFilter - The LINQ expression 'OrderBy<Currency, int>(     source: Where<Currency>(         source: Where<Currency>(             source: DbSet<Currency>,             predicate: (c) => !(((ISoftDelete)c).IsDeleted) || ((ISoftDelete)c).IsDeleted != (Unhandled parameter: __ef_filter__IsSoftDeleteFilterEnabled_0)),         predicate: (c) => (Nullable<int>)c.Id != (Unhandled parameter: __ou_CurrencyId_0)),     keySelector: (c) => (Unhandled parameter: __ObjectMapper_1).Map<CurrencyDto>(c).Id)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information. System.InvalidOperationException: The LINQ expression 'OrderBy<Currency, int>(     source: Where<Currency>(         source: Where<Currency>(             source: DbSet<Currency>,             predicate: (c) => !(((ISoftDelete)c).IsDeleted) || ((ISoftDelete)c).IsDeleted != (Unhandled parameter: __ef_filter__IsSoftDeleteFilterEnabled_0)),         predicate: (c) => (Nullable<int>)c.Id != (Unhandled parameter: __ou_CurrencyId_0)),     keySelector: (c) => (Unhandled parameter: __ObjectMapper_1).Map<CurrencyDto>(c).Id)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.    at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|8_0(ShapedQueryExpression translated, <>c__DisplayClass8_0& )    at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)    at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)    at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)    at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)    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_01.<ExecuteAsync>b__0()    at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func1 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.Query.Internal.EntityQueryable1.GetAsyncEnumerator(CancellationToken cancellationToken)    at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable1.GetAsyncEnumerator()    at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken)    at ioNob.h2oERP.Base.CurrenciesAppService.GetAll(GetAllCurrenciesInput input) in D:\GitRepo\h2oERPZero\aspnet-core\src\ioNob.h2oERP.Application\Base\CurrenciesAppService.cs:line 82    at lambda_method(Closure , Object )    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Raising error from these sections in service.

var currencies = await query                 .OrderBy(input.Sorting ?? "currency.id asc")                 .PageBy(input)                 .ToListAsync(); Anythings needs to be changed?

Thanks.


31 Answer(s)
  • User Avatar
    0
    joe704la created

    I am having very similar issues on all my custom services after the upgrade to 8.0.0 and haven't figured out what the true issue is. @mujthabagroad I am not following how you fixed it. Can you give me any advice?

    I have having issues in almost every service. But I can give an example below of one query that is causing an issue that didn't before the .NET Core 3 update. If I remove the "&& DateTime.Compare(Clock.Now, a.StartDateTime) > 0" it then seems to work. SO it seems like a simular issue to https://github.com/aspnetboilerplate/aspnetboilerplate/issues/5026#issuecomment-554157095 talking about here.

    var numberOfAppointments = await _appointmentRepository.GetAll() .Where(a => a.UserId == user.Id && DateTime.Compare(Clock.Now, a.StartDateTime) > 0).CountAsync();

  • User Avatar
    0
    mujthabagroad created

    Hi @joe704l,

    But we are facing different issue than yours. We added override method in dbcontext for custom filters. Facing issues there. If we commet those, will work all perfectly. @maliming can u look into it again as our license is going to be expired by tomorrow.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team

    hi @mujthabagroad Can you reproduce this problem using the Zero demo project? It’s too slow to solve the problem remotely.

  • User Avatar
    0
    dmerf created

    Has this problem been solved? We are about to proceed with full-scale development of our new ASP.NET Zero project. The split .NET Core 3.0 Host/Angular 8 solution which I downloaded about two weeks ago, verified and uploaded to our repo has started throwing this same error message "HttpRequestEntityChangeSetReasonProvider - Unable to get URL from HttpRequest, fallback to null". This happens when I code gen an entity from the database into the solution and try to navigate to the entity's index view while running. We also tested this on another developer machine which also was working before and also with a freshly download solution from ASP.NET Zero. We are completely blocked from starting development. We have two days left in our 30 day money-back guarantee period and we are contemplating our options moving forward given this showstopper issue along with all the other bugs, flaws and difficulties we have previously reported.

  • User Avatar
    0
    maliming created
    Support Team

    verified and uploaded to our repo has started throwing this same error message "HttpRequestEntityChangeSetReasonProvider - Unable to get URL from HttpRequest, fallback to null".

    This is just a DEBUG log for information purposes. This log will be removed with the next version.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.