Open Closed

Can't view page of host features definitions #4944


User avatar
0
zhongfang created
  • ABP Framework version: v7.1.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
[11:33:59 WRN] Unhandled exception rendering component: Value cannot be null. (Parameter 'stringLocalizer')
System.ArgumentNullException: Value cannot be null. (Parameter 'stringLocalizer')
   at Microsoft.Extensions.Localization.StringLocalizerExtensions.GetString(IStringLocalizer stringLocalizer, String name)
   at Volo.Abp.FeatureManagement.Blazor.Components.FeatureManagementModal.<>c__DisplayClass43_5.<BuildRenderTree>b__21(RenderTreeBuilder __builder9)
   at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
   at Blazorise.SelectItem`1.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
[11:33:59 ERR] Unhandled exception in circuit 'qZ_yD2E2sEZ7bY4bLqK6QptNM2WMr0hCZRrjd-heQQk'.
  • Steps to reproduce the issue:"
  • Create an application by ABP Suite.
  • Start debug Blazor.Server.Host
  • Login successfully.
  • Click administration
  • Click Settings
  • Click Feature Management
  • Click Manage Host features
  • It works well.
  • Change the database connection strong to my current running database which created by 2 year ago and working well after I upgrade to ABP 7.1.1
  • Star debug Blazor.Server.Host.... Click Manage Host features. Then I will get failed with above exception.

8 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Change the database connection strong to my current running database which created by 2 year ago and working well after I upgrade to ABP 7.1.1

    I think the main problem may be caused by the database, can you share the DB file to reproduce the problem? shiwei.liang@volosoft.com

  • User Avatar
    0
    zhongfang created

    I have checked the source code of ABP Framework. Volo.Abp.FeatureManagement Volo.Abp.FeatureManagement.Blazor /Components/FeatureManagementModal.razor line 65.

    I past the code as below

    <SelectItem Value="@item.Value">
        @CreateStringLocalizer(item.DisplayText.ResourceName).GetString(item.DisplayText.Name)
    </SelectItem>
    

    Sometimes, CreateStringLocalizer(item.DisplayText.ResourceName) return a null object. So, GetString will throw exception.

    You may think these senarios: Such as I change the file name /class name of Resource file. But a feature setting has already been stored into database many months ago...

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP will try to create IStringLocalizer by the default resource type.

    You can try:

    Configure<AbpLocalizationOptions>(options =>
    {
        options.DefaultResourceType = typeof(MyProjectNameResource);
    }
    
  • User Avatar
    0
    zhongfang created

    I place the code in ConfigureServices and PreConfigureServices.

    Configure&lt;AbpLocalizationOptions&gt;(options =>
            {
                options.DefaultResourceType = typeof(BlazorOneResource);
            });
    

    But I still get the same error as before.

  • User Avatar
    0
    zhongfang created

    At first, I placed the code in PreConfigureServices. Failed as before. Then, I placed the code in ConfigureServices, Failed again.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Ok, maybe something wrong.

    Can you provide the full steps that I can reproduce the problem? thanks.

    PS: I don't have a database from two years ago

  • User Avatar
    0
    zhongfang created

    Good question, I will prepare a new ABP solution for you. After I create it by ABP Suite.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok. thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09