Activities of "zhongfang"

But other module solutio can be build successfully within gitlab runner at linux server.

Very old project created by ABP suite. And upgrade from 5 to 6.0.0 to 6.0.1 Build successfully for several times even in local windows with VS 2022 and within gitlab runner at linux server.

After I comment 2 lines within above.

//using Volo.Abp.Validation.Localization;

        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<WeChatPayResource>("en")
                //.AddBaseTypes(typeof(AbpValidationResource))
                .AddVirtualJson("/Localization/WeChatPay");
        });

It build successfully in local windows machine with VS 2022. But will throw more exceptions within gitlab runner at linux server.

/src/modules/Yee.Change.PointPay/src/Yee.Change.PointPay.Application.Contracts/Shared/LookupRequestDto.cs(11,30): error CS0103: The name 'MaxMaxResultCount' does not exist in the current context [/src/modules/Yee.Change.PointPay/src/Yee.Change.PointPay.Application.Contracts/Yee.Change.PointPay.Application.Contracts.csproj]
/src/modules/Yee.Change.WeChatPay/src/Yee.Change.WeChatPay.Application.Contracts/Shared/LookupRequestDto.cs(11,30): error CS0103: The name 'MaxMaxResultCount' does not exist in the current context [/src/modules/Yee.Change.WeChatPay/src/Yee.Change.WeChatPay.Application.Contracts/Yee.Change.WeChatPay.Application.Contracts.csproj]
/src/modules/Yee.Change.Pay.Public/src/Yee.Change.Pay.Public.HttpApi/PublicController.cs(6,42): error CS0246: The type or namespace name 'AbpControllerBase' could not be found (are you missing a using directive or an assembly reference?) [/src/modules/Yee.Change.Pay.Public/src/Yee.Change.Pay.Public.HttpApi/Yee.Change.Pay.Public.HttpApi.csproj]
  Yee.Change.Pay.Public.Domain -> /app/build/Yee.Change.Pay.Public.Domain.dll
/src/src/Yee.Change.PayH5App.Domain.Shared/PayH5AppDomainSharedModule.cs(34,12): error CS0246: The type or namespace name 'AbpBackgroundJobsDomainSharedModule' could not be found (are you missing a using directive or an assembly reference?) [/src/src/Yee.Change.PayH5App.Domain.Shared/Yee.Change.PayH5App.Domain.Shared.csproj]
/src/modules/Yee.Change.WeChatPay/src/Yee.Change.WeChatPay.Domain/WeChatPayments/WeChatPayment.cs(10,66): error CS0433: The type 'IMultiTenant' exists in both 'Volo.Abp.MultiTenancy.Abstractions, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' and 'Volo.Abp.MultiTenancy, Version=6.0.1.0, Culture=neutral, PublicKeyToken=null' [/src/modules/Yee.Change.WeChatPay/src/Yee.Change.WeChatPay.Domain/Yee.Change.WeChatPay.Domain.csproj]
  • ABP Framework version: v6.0.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
/src/modules/Yee.Change.Pay.Public/src/Yee.Change.Pay.Public.Domain.Shared/ChangePayPublicDomainSharedModule.cs(5,35): error CS0234: The type or namespace name 'Localization' does not exist in the namespace 'Volo.Abp.Validation' (are you missing an assembly reference?) [/src/modules/Yee.Change.Pay.Public/src/Yee.Change.Pay.Public.Domain.Shared/Yee.Change.Pay.Public.Domain.Shared.csproj]
  • Steps to reproduce the issue:"
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.Validation;
using global::Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
using Yee.Change.Account;
using Yee.Change.Common;
using Yee.Change.Config;
using Yee.Change.Pay.Public.Localization;
using Yee.Change.Rms;
using Yee.Change.Shop;

namespace Yee.Change.Pay.Public;

[DependsOn(
    typeof(AbpValidationModule)
)]
[DependsOn(
    typeof(ShopDomainSharedModule),
    typeof(RmsDomainSharedModule),
    typeof(AccountDomainSharedModule),
    typeof(ChangeConfigDomainSharedModule),
    typeof(CommonDomainSharedModule)
    )]
public class ChangePayPublicDomainSharedModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<ChangePayPublicDomainSharedModule>();
        });

        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<PayPublicResource>("en")
                .AddBaseTypes(typeof(AbpValidationResource))
                .AddVirtualJson("/Localization/PayPublic");
        });

        Configure<AbpExceptionLocalizationOptions>(options =>
        {
            options.MapCodeNamespace("PayPublic", typeof(PayPublicResource));
        });
    }
}

If i use 'using global::Volo.Abp.Validation.Localization;', I will get the same error.

No restrict to get the service of ITenantRepository?

Can I get the ITenantRepository anywhere especially in backgroun worker class?

Oh...

ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>();

tenantRepository is null

2022-11-17 11:10:23.791 +08:00 [INF] Starting: 【扫码关注】积分发放... 2022-11-17 11:10:46.619 +08:00 [ERR] Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Yee.Change.AdminBlazorUI.WorkItems.FansJoinedNotifierWorkItem.FansSubscribedPoint() in D:\dev\abp\change\admin-blazor-ui\src\Yee.Change.AdminBlazorUI.Application\WorkItems\FansJoinedNotifierWorkItem.cs:line 97 at Yee.Change.AdminBlazorUI.WorkItems.FansJoinedNotifierWorkItem.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) in D:\dev\abp\change\admin-blazor-ui\src\Yee.Change.AdminBlazorUI.Application\WorkItems\FansJoinedNotifierWorkItem.cs:line 56 at Volo.Abp.BackgroundWorkers.AsyncPeriodicBackgroundWorkerBase.DoWorkAsync(CancellationToken cancellationToken) 2022-11-17 11:10:51.016 +08:00 [INF] Initialized all ABP modules.

and I try another way,

            ICurrentTenant currentTenant = this.LazyServiceProvider.LazyGetRequiredService&lt;ICurrentTenant&gt;();
            ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService&lt;ITenantRepository&gt;();

            if (allTenants == null)
            {
                using (currentTenant.Change(null))
                {
                    allTenants = await tenantRepository.GetListAsync();
                }
            }

got the same error again: Object reference not set to an instance of an object.

public class FansJoinedNotifierWorkItem : AsyncPeriodicBackgroundWorkerBase
{
    public FansJoinedNotifierWorkItem(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory) : base(timer, serviceScopeFactory)
    {
        this.Timer.Period = 60 * 1000;
    }

    protected async override Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
    {
        this.Timer.Period = 1440 * 60 * 1000;

        扫码关注送积分 subscribPoint = new 扫码关注送积分();
        subscribPoint.LazyServiceProvider = this.LazyServiceProvider;
        await this.FansSubscribedPoint();
        
        this.Timer.Period = siteOptions.Value.UserFollowNotifyIntervalMinutes * 60 * 1000;
    }

    static List<Tenant> allTenants;
    public async Task FansSubscribedPoint()
    {
        Log.Information("Starting: 【扫码关注】积分发放...");
        
        IDataFilter dataFilter = this.LazyServiceProvider.LazyGetRequiredService<IDataFilter>();

        if (allTenants == null)
        {
            using (dataFilter.Disable<IMultiTenant>())
            {
                ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>();

                allTenants = await tenantRepository.GetListAsync();
            }
        }

        ……

        Log.Information("Completed: 【扫码关注】积分发放...");
    }
}
  • ABP Framework version: v6.0.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: System.NullReferenceException:“Object reference not set to an instance of an object.”
  • Steps to reproduce the issue:" 1)method in background worker 2)ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>(); 3)List<Tenant> allTenants = await tenantRepository.GetListAsync();
Showing 91 to 100 of 185 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 10, 2025, 12:02
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.