Open Closed

What wrong with my menu construction? May ABP framework throw detail exception for us to debug? #5186


User avatar
0
zhongfang created
  • ABP Framework version: v7.2.2
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
[11:57:25 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:ChangeAdmin.Admin
[11:57:25 DBG] Not found in the cache: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:ChangeAdmin.Admin
[11:57:25 DBG] Getting all granted permissions from the repository for this provider name,key: U,2b080ea8-6fdc-5e40-685e-39fe0f560247
[11:57:26 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:SettingManagement.Emailing
[11:57:26 DBG] Not found in the cache: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:SettingManagement.Emailing
[11:57:26 DBG] Getting all granted permissions from the repository for this provider name,key: U,2b080ea8-6fdc-5e40-685e-39fe0f560247
[11:57:26 WRN] Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout.SideMenu.Navigation.MobileNavbar.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
[11:57:26 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:ChangeAdmin.Admin
[11:57:26 DBG] Not found in the cache: pn:U,pk:2b080ea8-6fdc-5e40-685e-39fe0f560247,n:ChangeAdmin.Admin
[11:57:26 DBG] Getting all granted permissions from the repository for this provider name,key: U,2b080ea8-6fdc-5e40-685e-39fe0f560247
[11:57:26 DBG] Added 0 entity changes to the current audit log
[11:57:26 DBG] Added 0 entity changes to the current audit log
[11:57:26 DBG] Added 0 entity changes to the current audit log
[11:57:26 DBG] Added 0 entity changes to the current audit log
  • Steps to reproduce the issue:"
  • Start debug in Visual Studio 2022 in a module or application which dependes on many other modules created by ABP Suite.
  • Browser will display yellow line under the status buar (just the default Blazor error view).
  • Found exception in console.
  • Refresh the page in browser, page will go well with no exception. It seems evertying is normal.
  • It means that when you first open the page, you will get above exception. When you refresh immediatelly, it will be normal.

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

    Hi,

    Are you using Blazor or Blazor server?

  • User Avatar
    0
    zhongfang created

    Yes, I am using Blazor Server. With the same code, If I use Lepton, there is no error. After I replace/change the theme from Lepton to LeptonX, I will get above error.

  • User Avatar
    0
    zhongfang created

    Let'm give you more detail description.

    1. When I didn't logged in, the page displayed normally. 2)Then I will login with username and password. I will get above exception. Then I will refresh the page, the exception disappeared.
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok, I will check it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We fixed it in the next version, your ticket refunded.

    You can try this:

    using System.Collections.Generic;
    using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout.SideMenu.Navigation;
    using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Navigation;
    using Volo.Abp.DependencyInjection;
    
    namespace Qa.Blazor.Pages;
    
    [ExposeServices(typeof(MobileNavbar))]
    public class MyMobileNavbar : MobileNavbar
    {
        public MyMobileNavbar()
        {
            SelectedMenuItems = new List<MenuItemViewModel>();
        }
    }
    
  • User Avatar
    0
    zhongfang created

    Thank you! It work well now.

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