Open Closed

Reload error on page initialization - drop in Lepton theme MainHeader.razor.cs #3051


User avatar
0
miroslava.pekarova@m2ms.sk created

Hello, we are experiencing reload errors in our applicaton, Application drops in Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnNavBarMouseOverAsync() and then error is thrown in our page init method which cause reload error on page.

  • ABP Framework version: v4.4.4

  • UI type: Blazor

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes

  • Exception message and stack trace: 2022-05-10 13:08:12.107 +02:00 [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.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnNavBarMouseOverAsync() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\modules\Volo.LeptonTheme\src\Volo.Abp.AspNetCore.Components.Web.LeptonTheme\Components\ApplicationLayout\MainHeader\MainHeader.razor.cs:line 104 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2022-05-10 13:08:12.119 +02:00 [ERR] Unhandled exception in circuit 'zP9Kt0TAqybL-v3Lm7lxVbnCzOM9MWDSpdrEtG-spVg'. System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnNavBarMouseOverAsync() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\modules\Volo.LeptonTheme\src\Volo.Abp.AspNetCore.Components.Web.LeptonTheme\Components\ApplicationLayout\MainHeader\MainHeader.razor.cs:line 104 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2022-05-10 13:08:12.158 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.DropDowns/scripts/sf-dropdownlist-169302.min.js - - 2022-05-10 13:08:12.161 +02:00 [INF] The file /_content/Syncfusion.Blazor.DropDowns/scripts/sf-dropdownlist-169302.min.js was not modified 2022-05-10 13:08:12.161 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.DropDowns/scripts/sf-dropdownlist-169302.min.js - - - 304 - application/javascript 2.3360ms 2022-05-10 13:08:12.161 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Grid/scripts/sf-grid-169302.min.js - - 2022-05-10 13:08:12.161 +02:00 [INF] The file /_content/Syncfusion.Blazor.Grid/scripts/sf-grid-169302.min.js was not modified 2022-05-10 13:08:12.161 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Grid/scripts/sf-grid-169302.min.js - - - 304 - application/javascript 0.6088ms 2022-05-10 13:08:12.162 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Notifications/scripts/sf-toast-169302.min.js - - 2022-05-10 13:08:12.162 +02:00 [INF] The file /_content/Syncfusion.Blazor.Notifications/scripts/sf-toast-169302.min.js was not modified 2022-05-10 13:08:12.162 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Notifications/scripts/sf-toast-169302.min.js - - - 304 - application/javascript 0.5907ms 2022-05-10 13:08:12.162 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Popups/scripts/sf-dialog-169302.min.js - - 2022-05-10 13:08:12.164 +02:00 [INF] The file /_content/Syncfusion.Blazor.Popups/scripts/sf-dialog-169302.min.js was not modified 2022-05-10 13:08:12.164 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Popups/scripts/sf-dialog-169302.min.js - - - 304 - application/javascript 2.0609ms 2022-05-10 13:08:12.164 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Calendars/scripts/sf-datepicker-169302.min.js - - 2022-05-10 13:08:12.165 +02:00 [INF] The file /_content/Syncfusion.Blazor.Calendars/scripts/sf-datepicker-169302.min.js was not modified 2022-05-10 13:08:12.165 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Calendars/scripts/sf-datepicker-169302.min.js - - - 304 - application/javascript 0.7299ms 2022-05-10 13:08:12.165 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Navigations/scripts/sf-toolbar-169302.min.js - - 2022-05-10 13:08:12.167 +02:00 [INF] The file /_content/Syncfusion.Blazor.Navigations/scripts/sf-toolbar-169302.min.js was not modified 2022-05-10 13:08:12.167 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/_content/Syncfusion.Blazor.Navigations/scripts/sf-toolbar-169302.min.js - - - 304 - application/javascript 2.0123ms 2022-05-10 13:08:12.242 +02:00 [INF] Received HTTP response headers after 1016.003ms - 200 2022-05-10 13:08:12.242 +02:00 [INF] End processing HTTP request after 1016.2843ms - 200 2022-05-10 13:08:12.290 +02:00 [INF] Received HTTP response headers after 1029.7691ms - 200 2022-05-10 13:08:12.290 +02:00 [INF] End processing HTTP request after 1029.9445ms - 200 2022-05-10 13:08:12.318 +02:00 [INF] Executed endpoint '/_blazor' 2022-05-10 13:08:12.318 +02:00 [INF] Request finished HTTP/1.1 GET https://epm.ad.m2ms.sk:44314/_blazor?id=WVjBCaCHQ9GJxnlkV5myRQ - - - 101 - - 1206.5729ms 2022-05-10 13:08:12.337 +02:00 [INF] Received HTTP response headers after 662.0987ms - 200 2022-05-10 13:08:12.337 +02:00 [INF] End processing HTTP request after 662.3835ms - 200 2022-05-10 13:08:12.379 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/__bundles/bootstrap.min.css.map - - 2022-05-10 13:08:12.412 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/__bundles/bootstrap.min.css.map - - - 302 - - 33.6809ms 2022-05-10 13:08:12.457 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/Error?httpStatusCode=404 - - 2022-05-10 13:08:12.458 +02:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2022-05-10 13:08:12.458 +02:00 [INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2022-05-10 13:08:12.509 +02:00 [INF] Executing ViewResult, running view ~/Views/Error/404.cshtml. 2022-05-10 13:08:12.519 +02:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing 2022-05-10 13:08:12.519 +02:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpAccount.SettingManagement 2022-05-10 13:08:12.519 +02:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpIdentity.SettingManagement 2022-05-10 13:08:12.519 +02:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: LeptonThemeManagement.Settings 2022-05-10 13:08:12.550 +02:00 [INF] Start processing HTTP request GET "https://epm.ad.m2ms.sk:44335/api/app/firm-agenda-areas/all?DeletedRecords=False&SkipCount=0&MaxResultCount=10&api-version=1.0" 2022-05-10 13:08:12.550 +02:00 [INF] Sending HTTP request GET "https://epm.ad.m2ms.sk:44335/api/app/firm-agenda-areas/all?DeletedRecords=False&SkipCount=0&MaxResultCount=10&api-version=1.0" 2022-05-10 13:08:12.917 +02:00 [INF] Received HTTP response headers after 367.272ms - 200 2022-05-10 13:08:12.917 +02:00 [INF] End processing HTTP request after 367.465ms - 200 2022-05-10 13:08:12.958 +02:00 [INF] Executed ViewResult - view ~/Views/Error/404.cshtml executed in 449.4967ms. 2022-05-10 13:08:12.958 +02:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) in 500.2668ms 2022-05-10 13:08:12.958 +02:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2022-05-10 13:08:12.975 +02:00 [INF] Request finished HTTP/2 GET https://epm.ad.m2ms.sk:44314/Error?httpStatusCode=404 - - - 404 - text/html;+charset=utf-8 518.3751ms 2022-05-10 13:08:13.090 +02:00 [WRN] Could not find IdentityClientConfiguration for Default. Either define a configuration for Default or set a default configuration. 2022-05-10 13:08:13.090 +02:00 [INF] Start processing HTTP request GET "https://epm.ad.m2ms.sk:44335/api/app/contractors/work-activity-category-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2022-05-10 13:08:13.090 +02:00 [INF] Sending HTTP request GET "https://epm.ad.m2ms.sk:44335/api/app/contractors/work-activity-category-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2022-05-10 13:08:13.373 +02:00 [INF] Received HTTP response headers after 282.6831ms - 401 2022-05-10 13:08:13.373 +02:00 [INF] End processing HTTP request after 283.1558ms - 401 2022-05-10 13:08:13.384 +02:00 [WRN] Unhandled exception rendering component: Autorizácia zlyhala! Daná politika nebola udelená. Volo.Abp.Http.Client.AbpRemoteCallException: Autorizácia zlyhala! Daná politika nebola udelená. at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAsync(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetResultAsync(Task task, Type resultType) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.GetWorkActivityCategoryLookupAsync(String text) in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 736 at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.LoadFilterDropdowns() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 209 at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.OnInitializedAsync() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 166 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2022-05-10 13:08:13.384 +02:00 [ERR] Unhandled exception in circuit 'zP9Kt0TAqybL-v3Lm7lxVbnCzOM9MWDSpdrEtG-spVg'. Volo.Abp.Http.Client.AbpRemoteCallException: Autorizácia zlyhala! Daná politika nebola udelená. at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.ThrowExceptionForResponseAsync(HttpResponseMessage response) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAsync(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetResultAsync(Task task, Type resultType) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.GetWorkActivityCategoryLookupAsync(String text) in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 736 at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.LoadFilterDropdowns() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 209 at M2MS.Mondi.ePM.Blazor.Pages.ContractorManagement.Contractors.OnInitializedAsync() in C:\GitLab\Runner\builds\rBn-kAxN\0\m2ms\management-portals\epm\src\M2MS.Mondi.ePM.Blazor\Pages\ContractorManagement\Contractors.razor.cs:line 166 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2022-05-10 13:08:27.401 +02:00 [INF] Request starting HTTP/2 GET https://epm.ad.m2ms.sk:44314/audit-logs - -

  • Steps to reproduce the issue:" Application is running and we are working in application for some time. Application drops after redirect to new page or new tab.


2 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    @enis this is where we get the NullReferenceException.

    Menu can be null in MainHeader.cs

        private async Task OnNavBarMouseOverAsync()
        {
            if (Menu.NavBarStatus == MenuStatus.OpenOnHover)
            {
                if (await UtilsService.HasClassOnTagAsync("body", "lp-closed"))
                {
                    await UtilsService.AddClassToTagAsync("body", "lp-extended");
                }
            }
        }
    
  • User Avatar
    0
    michal.cadecky@m2ms.sk created

    @enis this is where we get the NullReferenceException.

    Menu can be null in MainHeader.cs

        private async Task OnNavBarMouseOverAsync() 
        { 
            if (Menu.NavBarStatus == MenuStatus.OpenOnHover) 
            { 
                if (await UtilsService.HasClassOnTagAsync("body", "lp-closed")) 
                { 
                    await UtilsService.AddClassToTagAsync("body", "lp-extended"); 
                } 
            } 
        } 
    

    It is possible that Menu might be null but the question is why this is hapenning. The reason why we have included Lepton Theme projects source code to the main solution is crashing caused by Menu being null during disposal.

            public void Dispose()
            {
                if (Menu is not null)
                {
                    Menu.StateChanged -= RefreshMenu;
                }
    
                NavigationManager.LocationChanged -= OnLocationChanged;
            }
    

    Similary we modified the MainSiderbar. But if Menu is somehow null, it implies that component has not been initialized via OnInitializedAsync - how could be this possible?

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11