Hi
so, Is it normal "I replaced these Repositories, so I will not use dbContext.SessionHandle if it is null"?
Hello, I use Identity Server... After upgrade ABP from 5.3.3 to 7.3.1 I have a problem... The repositories MongoDeviceFlowCodesRepository and MongoPersistentGrantRepository invoke method DeleteDirectAsync { .... await collection.DeleteManyAsync( dbContext.SessionHandle, Builders<PersistedGrant>.Filter.Where(predicate), cancellationToken: cancellationToken ); .... }
but dbContext.SessionHandle = null and that method is crashed
I replaced these Repositories, so I will not use dbContext.SessionHandle if it is null.
this code appeared in 7.3.1,
1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionBase1.DeleteManyAsync(FilterDefinition1 filter, DeleteOptions options, Func3 bulkWriteFuncAsync) at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.DeleteDirectAsync(Expression1 predicate, CancellationToken cancellationToken) at Volo.Abp.IdentityServer.MongoDB.MongoPersistentGrantRepository.DeleteExpirationAsync(DateTime maxExpirationDate, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.RemoveGrantsAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.CleanAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) at Volo.Abp.BackgroundWorkers.Quartz.QuartzPeriodicBackgroundWorkerAdapter1.Execute(IJobExecutionContext context)
at Quartz.Core.JobRunShell.Run(CancellationToken cancellationToken)
2023-11-01 03:10:13.226 +00:00 [ERR] Job DEFAULT.Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker threw an exception.
Quartz.SchedulerException: Job threw an unhandled exception.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'session')
at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName)
at MongoDB.Driver.MongoCollectionImpl1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionBase1.DeleteManyAsync(FilterDefinition1 filter, DeleteOptions options, Func3 bulkWriteFuncAsync) at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.DeleteDirectAsync(Expression1 predicate, CancellationToken cancellationToken) at Volo.Abp.IdentityServer.MongoDB.MongoPersistentGrantRepository.DeleteExpirationAsync(DateTime maxExpirationDate, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.RemoveGrantsAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.CleanAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) at Volo.Abp.BackgroundWorkers.Quartz.QuartzPeriodicBackgroundWorkerAdapter1.Execute(IJobExecutionContext context)
at Quartz.Core.JobRunShell.Run(CancellationToken cancellationToken)
--- End of inner exception stack trace --- [See nested exception: System.ArgumentNullException: Value cannot be null. (Parameter 'session')
at MongoDB.Driver.Core.Misc.Ensure.IsNotNull[T](T value, String paramName)
at MongoDB.Driver.MongoCollectionImpl1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionBase1.DeleteManyAsync(FilterDefinition1 filter, DeleteOptions options, Func3 bulkWriteFuncAsync) at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository2.DeleteDirectAsync(Expression1 predicate, CancellationToken cancellationToken) at Volo.Abp.IdentityServer.MongoDB.MongoPersistentGrantRepository.DeleteExpirationAsync(DateTime maxExpirationDate, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.RemoveGrantsAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupService.CleanAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) at Volo.Abp.BackgroundWorkers.Quartz.QuartzPeriodicBackgroundWorkerAdapter1.Execute(IJobExecutionContext context)
at Quartz.Core.JobRunShell.Run(CancellationToken cancellationToken)]Hello
I have found some code with query(It did not work in CosmosDB):
namespace Volo.Abp.PermissionManagement.MongoDB;
public class MongoPermissionGrantRepository :   MongoDbRepository<IPermissionManagementMongoDbContext, PermissionGrant, Guid>,
    IPermissionGrantRepository
{
    public MongoPermissionGrantRepository(IMongoDbContextProvider<IPermissionManagementMongoDbContext> dbContextProvider)
        : base(dbContextProvider)
    {
  }
    public virtual async Task<PermissionGrant> FindAsync(
        string name,
        string providerName,
        string providerKey,
        CancellationToken cancellationToken = default)
    {
        cancellationToken = GetCancellationToken(cancellationToken);
        return await (await GetMongoQueryableAsync(cancellationToken))
            **.OrderBy(x => x.Id)**
            .FirstOrDefaultAsync(s =>
                s.Name == name &&
                s.ProviderName == providerName &&
                s.ProviderKey == providerKey,
                cancellationToken
            );
    }
MongoDB get next query:
"aggregate":"AbpPermissionGrants",
      "pipeline":[
         {
            "$match":{
               "TenantId":null
            }
         },
         {
            "$sort":{
               "_id":1
            }
         },
         {
            "$match":{
               "Name":"Dibl.Themes.View",
               "ProviderName":"R",
               "ProviderKey":"Facilitator"
            }
         },
Why did you use OrderBy(x => x.Id) in this query? And I think "$sort" hurts query performance...
Best regards, Advantiss Inc
Hello
We have already used file-manager from code I found and corrected code Problem was solved
Thank you
Hello I added this code after class AppComponent and I did not see any changes in UI It is does not work for my application Does my version of Abp(5.3.3) support it decision?
Hello Where I need to paste this code in app.component.ts?
By default file-management can upload all types of file Need to upload only some types of files with extensions "JPEG,PNG,ICO.GIF,TIFF". Could I do this simple or I need to correct file-management module? Maybe simple solution exists, but I can not found it.
Best regards Advantiss.
Need to add validation messages for Add Tenant form as on Add User form If click Save on empty user form I will get error messages
but on empty Add Tenant form button Save disables, and users can not get information for incorrect fields
I removed code for disabling button, but I could not get any messages from field validations I used Volo.Identity.Pro How I can do this in best way?
Thank you. Best regards Advantiss.
Try to add this to your startup project.
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.5" />
Hi I have added but it did not fix this problem Do you have any another ideas?
 
                                