Base solution for your next web application
Open Closed

Filter error on 8.9.2 upgrade #9211


User avatar
0
alukaszewski created

I've just upgraded to 8.9.2 and on my local build it works fine, but when I publish to Azure I am getting this exception:

WARN 2020-06-16 06:22:44,007 [45 ] Abp.BackgroundJobs.BackgroundJobManager - Abp.AbpException: Unknown filter name: MayHaveTenant. Be sure this filter is registered before. at Abp.Domain.Uow.UnitOfWorkBase.GetFilterIndex(String filterName) at Abp.Domain.Uow.UnitOfWorkBase.SetFilterParameter(String filterName, String parameterName, Object value) at Abp.Domain.Uow.UnitOfWorkBase.SetTenantId(Nullable1 tenantId, Boolean switchMustHaveTenantEnableDisable) at Abp.Domain.Uow.UnitOfWorkBase.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkManager.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation) at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.BackgroundJobStoreProxy.GetWaitingJobs(Int32 maxResultCount) at Abp.BackgroundJobs.BackgroundJobManager.DoWork() at Castle.Proxies.BackgroundJobManagerProxy.DoWork_callback() at Castle.Proxies.Invocations.BackgroundJobManager_DoWork.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation) at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.BackgroundJobManagerProxy.DoWork() at Abp.Threading.BackgroundWorkers.PeriodicBackgroundWorkerBase.Timer_Elapsed(Object sender, EventArgs e) Abp.AbpException: Unknown filter name: MayHaveTenant. Be sure this filter is registered before. at Abp.Domain.Uow.UnitOfWorkBase.GetFilterIndex(String filterName) at Abp.Domain.Uow.UnitOfWorkBase.SetFilterParameter(String filterName, String parameterName, Object value) at Abp.Domain.Uow.UnitOfWorkBase.SetTenantId(Nullable1 tenantId, Boolean switchMustHaveTenantEnableDisable) at Abp.Domain.Uow.UnitOfWorkBase.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkManager.Begin(UnitOfWorkOptions options) at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation) at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.BackgroundJobStoreProxy.GetWaitingJobs(Int32 maxResultCount) at Abp.BackgroundJobs.BackgroundJobManager.DoWork() at Castle.Proxies.BackgroundJobManagerProxy.DoWork_callback() at Castle.Proxies.Invocations.BackgroundJobManager_DoWork.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation) at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.BackgroundJobManagerProxy.DoWork() at Abp.Threading.BackgroundWorkers.PeriodicBackgroundWorkerBase.Timer_Elapsed(Object sender, EventArgs e)

It's stating that MayHaveTenant filter is not being registered at startup. I still have in my DbContext base.OnModelCreating(modelBuilder); at the start so I am running out of ideas. Anything simple I could have missed?


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @alukaszewski

    Can you reproduce this on a new 8.9.2 project ? If not, is it possible for you to share your project with [email protected] ?

  • User Avatar
    0
    alukaszewski created

    I've just published base 8.9.2 to our staging appservice and it worked fine, so something in our code is causing the issue or I am messing something up in the merge. I'm not able to share the project as it has sensitive information in the codebase (keys). If there's nothing more obvious other than the dbcontext onmodelcreating call, I'll have to try and trace the issue in our code.

    Thank you for replying

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Those filters are registered here https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/AbpKernelModule.cs#L55. So, your module somehow must depend on this module. Normally modules depends on this module indirectly. Could you share your Core module class dependencies ?

  • User Avatar
    0
    alukaszewski created

    Hi,

    Thanks for replying.

    Which file are you wanting to see? Is it the *CoreModule.cs class from the Core project?

  • User Avatar
    0
    ismcagdas created
    Support Team

    @alukaszewski,

    Yes, correct.

  • User Avatar
    0
    marble68 created

    My project was working in production, just pushed an update and I'm getting this error now, too.

    It's azure, so it's for sure production.

    Any tips?

  • User Avatar
    1
    marble68 created

    Figured mine out. It's that int filter issue again with DTOs.

    I had one that I didn't set to -1, so every time it did a GetAll on an important entity it was failing.

    If you have a filter object, and in your GetAll, you have there WhereIf(input.filterName>-1....)

    What happens is the object mapper or something sets these to 0, triggering the filter.

    In my case, I have a condition with one filter where another is always true - but because I didn't set the default value to -1, it was passing 0..

    In this instance the 0 was asking for a condition that would cause a tenants entire install to go down.

    I have to remember these!

  • User Avatar
    0
    demo.solaru created

    Hello @marble68

    I am getting same error, and I am lost what to start looking for. So this happens when I have used Enable or Disable filter?

    I had one that I didn't set to -1, so every time it did a GetAll on an important entity it was failing. So for this one, where you did not set -1?

    What happens is the object mapper or something sets these to 0, triggering the filter. So could you be able to explain this in more?

    Your answer would be appriciated in order to resolve this issue. Thanks!

  • User Avatar
    0
    demo.solaru created

    Solution that worked for my project: #9534