Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException in Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader #20616

Closed
1 task done
sturlath opened this issue Aug 25, 2024 · 7 comments
Assignees
Labels

Comments

@sturlath
Copy link
Contributor

sturlath commented Aug 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description

Coming back to a open tab and refreshing I´m getting that error and no amount of F5 fixes the issue. The only thing possible is to clear all application data (totally not something a normal user is expected to do)

image

The issue seems to be in code handling of "Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.Dispose()"

 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.Dispose()
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.DisposeAsync()

Full log. As you can see the user seem to be no longer with valid credentials.

2024-08-25 09:57:00.111 +00:00 [INF] Request starting HTTP/1.1 GET https://bdev.azurewebsites.net/_blazor?id=gYLNS8XpuBv26ACP5DPUCw - null null
2024-08-25 09:57:00.118 +00:00 [INF] Executing endpoint '/_blazor'
2024-08-25 09:57:00.430 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: SettingManagement.Emailing
2024-08-25 09:57:00.442 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: SettingManagement.TimeZone
2024-08-25 09:57:00.465 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: SettingManagement.Emailing
2024-08-25 09:57:00.465 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AbpAccount.SettingManagement
2024-08-25 09:57:00.490 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AuditLogging.AuditLogs.SettingManagement
2024-08-25 09:57:00.501 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: SettingManagement.TimeZone
2024-08-25 09:57:00.511 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AbpIdentity.SettingManagement
2024-08-25 09:57:00.528 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AbpAccount.SettingManagement
2024-08-25 09:57:00.543 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AuditLogging.AuditLogs.SettingManagement
2024-08-25 09:57:00.552 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: FeatureManagement.ManageHostFeatures
2024-08-25 09:57:00.577 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: AbpIdentity.SettingManagement
2024-08-25 09:57:00.603 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: CmsKit.SettingManagement
2024-08-25 09:57:00.603 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: FeatureManagement.ManageHostFeatures
2024-08-25 09:57:00.647 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: CmsKit.SettingManagement
2024-08-25 09:57:00.648 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: LeptonThemeManagement.Settings
2024-08-25 09:57:00.661 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: Beinni.GlobalHostAdminSettings
2024-08-25 09:57:00.683 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: LeptonThemeManagement.Settings
2024-08-25 09:57:00.703 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: Beinni.GlobalHostAdminSettings
2024-08-25 09:57:01.158 +00:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: Payment.Plans
2024-08-25 09:57:01.161 +00:00 [INF] Request starting HTTP/1.1 GET https://bdev.azurewebsites.net/images/logo/lepton/logo-light.png - null null
2024-08-25 09:57:01.161 +00:00 [INF] The file /images/logo/lepton/logo-light.png was not modified
2024-08-25 09:57:01.162 +00:00 [INF] Request finished HTTP/1.1 GET https://bdev.azurewebsites.net/images/logo/lepton/logo-light.png - 304 null image/png 1.0878ms
2024-08-25 09:57:01.162 +00:00 [INF] Request starting HTTP/1.1 GET https://bdev.azurewebsites.net/api/account/profile-picture-file/749fd415-414d-bb40-fd4a-3a147e49a7f8 - null null
2024-08-25 09:57:01.170 +00:00 [INF] Executing endpoint 'Volo.Abp.Account.AccountController.GetProfilePictureFileAsync (Volo.Abp.Account.Pro.Public.HttpApi)'
2024-08-25 09:57:01.170 +00:00 [INF] Route matched with {area = "account", action = "GetProfilePictureFile", controller = "Account", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Content.IRemoteStreamContent] GetProfilePictureFileAsync(System.Guid) on controller Volo.Abp.Account.AccountController (Volo.Abp.Account.Pro.Public.HttpApi).
2024-08-25 09:57:01.172 +00: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.RxudEaLQCq()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnAfterRenderAsync(Boolean firstRender)
2024-08-25 09:57:01.172 +00:00 [ERR] Unhandled exception in circuit 'YbIQnOBdSjbZvSGYFtfMmSkGa78uRAbWW5x1LP4JvNo'.
System.AggregateException: One or more errors occurred. (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.RxudEaLQCq()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnAfterRenderAsync(Boolean firstRender)
   --- End of inner exception stack trace ---
2024-08-25 09:57:01.176 +00:00 [INF] Request starting HTTP/1.1 GET https://bdev.azurewebsites.net/libs/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2 - null null
2024-08-25 09:57:01.177 +00: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.Dispose()
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.DisposeAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.Dispose(Boolean disposing)

Then probably because of that error few other errors follow

024-08-25 09:57:01.239 +00:00 [WRN] Unhandled exception rendering component: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
   at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.CreateScope(IServiceProvider provider)
   at Volo.Abp.SimpleStateChecking.SimpleStateCheckerManager`1.IsEnabledAsync(TState[] states)
   at Volo.Abp.UI.Navigation.MenuManager.CheckPermissionsAsync(IServiceProvider serviceProvider, IHasMenuItems menuWithItems)
   at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
   at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainMenuProvider.GetMenuAsync()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainSiderbar.N5fH29GlT()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainSiderbar.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
2024-08-25 09:57:01.239 +00:00 [ERR] Unhandled exception in circuit 'YbIQnOBdSjbZvSGYFtfMmSkGa78uRAbWW5x1LP4JvNo'.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
   at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.CreateScope(IServiceProvider provider)
   at Volo.Abp.SimpleStateChecking.SimpleStateCheckerManager`1.IsEnabledAsync(TState[] states)
   at Volo.Abp.UI.Navigation.MenuManager.CheckPermissionsAsync(IServiceProvider serviceProvider, IHasMenuItems menuWithItems)
   at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
   at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainMenuProvider.GetMenuAsync()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainSiderbar.N5fH29GlT()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainSiderbar.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
2024-08-25 09:57:01.247 +00:00 [INF] Executed endpoint '/_blazor'
2024-08-25 09:57:01.247 +00:00 [INF] Request finished HTTP/1.1 GET https://bdev.azurewebsites.net/_blazor?id=gYLNS8XpuBv26ACP5DPUCw - 101 null null 1135.4871ms
2024-08-25 09:57:01.249 +00:00 [WRN] Unhandled exception rendering component: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
   at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.CreateScope(IServiceProvider provider)
   at Volo.Abp.SimpleStateChecking.SimpleStateCheckerManager`1.IsEnabledAsync(TState[] states)
   at Volo.Abp.UI.Navigation.MenuManager.CheckPermissionsAsync(IServiceProvider serviceProvider, IHasMenuItems menuWithItems)
   at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
   at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainMenuProvider.GetMenuAsync()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
2024-08-25 09:57:01.249 +00:00 [ERR] Unhandled exception in circuit 'YbIQnOBdSjbZvSGYFtfMmSkGa78uRAbWW5x1LP4JvNo'.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
   at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.CreateScope(IServiceProvider provider)
   at Volo.Abp.SimpleStateChecking.SimpleStateCheckerManager`1.IsEnabledAsync(TState[] states)
   at Volo.Abp.UI.Navigation.MenuManager.CheckPermissionsAsync(IServiceProvider serviceProvider, IHasMenuItems menuWithItems)
   at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
   at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainMenuProvider.GetMenuAsync()
   at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Reproduction Steps

N/A but you should at least look at the code that is throwing the NullReferenceException and prevent that!

Expected behavior

If the user no longer has valid credentials he/she should be routed to a login page or the a refresh token mechanishm should kick in.

Actual behavior

The page becomes useless!

Regression?

First time I´m seeing this after updating to 8.2.x

Known Workarounds

Nuke the application data in the browser.. not viable

Version

8.2.2

User Interface

Blazor Server

Database Provider

EF Core (Default)

Tiered or separate authentication server

Tiered

Operation System

Windows (Default)

Other information

I sure hope you harden this code part in 8.2.3!

@sturlath sturlath added the bug label Aug 25, 2024
@sturlath
Copy link
Contributor Author

@EngincanV @maliming no feedback on this? Unfortunatly I can´t create a demo code using the pro version to share with you...

@sturlath
Copy link
Contributor Author

I have figured out that this only happens when I F5 the page but if I navigate to it by menu this doesn´t happen. 🤷‍♂️

@sturlath
Copy link
Contributor Author

sturlath commented Sep 1, 2024

I have been trying to figure this out but I can see anything else than the MainHeader.cs needs to add some IsDisposed/nullreference-check logic..

Correct me if I´m wrong here...

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.RxudEaLQCq()
at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnAfterRenderAsync(Boolean firstRender)
2024-09-01 07:04:42.827 +00:00 [ERR] Unhandled exception in circuit '3c4nwfCF6tmsOj4Wr61u28HuZzFtHhFtTy3hRSsakAA'.
System.AggregateException: One or more errors occurred. (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.RxudEaLQCq()
at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.OnAfterRenderAsync(Boolean firstRender)
--- End of inner exception stack trace ---

image

Anything I can try out or change/override/etc?

@maliming
Copy link
Member

maliming commented Sep 2, 2024

You'd better share a project that can reproduce the problem. This way we can find the cause as quickly as possible

@sturlath
Copy link
Contributor Author

sturlath commented Sep 3, 2024

You'd better share a project that can reproduce the problem. This way we can find the cause as quickly as possible
🤷‍♂️no idea how I can do that without having access to the pro version.. but I guess somebody else will hit this when they update to newest Blazorise using Lepton on Blazor Server... I will consider downgrading...

@bgmulinari
Copy link

Hey there. I see that this issue is closed but I don't see what was the solution. I'm facing the same problem as shown below.

It's weird because the error seems to happen at random (about 50% of the times) when refreshing the login screen. I tried different Blazorise versions without success. I'm on ABP 8.3.2.

image

image

@maliming
Copy link
Member

hi

I have reproduced the problem. I will fix this in 8.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants