- fail: Microsoft.AspNetCore.Components.Web.ErrorBoundary[0]
System.NullReferenceException: Arg_NullReferenceException
at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement.pn1KN6jQ65(Object )
at Volo.Abp.BlazoriseUI.Components.AbpExtensibleDataGrid
1.<>c__DisplayClass53_3.<<BuildRenderTree>b__18>d[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Volo.Abp.BlazoriseUI.Components.EntityAction1.<ActionClickedAsync>d__53[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Blazorise.DropdownItem.ClickHandler() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) - Steps to reproduce the issue: This error occurs for both Interactive Auto and Interactive Server rendering modes.
- As an admin user, navigate to the User list.
- Click 'Sessions' or 'View Details'
- An error occurs. Based on what I've been able to gather from debugging the compiled binaries,
SessionsModalis null andViewDetailsModalis null.
3 Answer(s)
-
0
- Solution
Root cause: A known NullReferenceException occurs on the Users page when clicking entity actions (like Sessions or View Details) if the corresponding modal/component references are not initialized in Blazor Web App (Interactive Server/Auto). In ABP 10.0 (Identity Pro Blazor), the action handlers expect their modal components to be present and referenced. If those components are missing/not rendered (e.g., conditional rendering or missing @ref), the backing fields like SessionsModal or ViewDetailsModal are null and actions throw.
Fix: Ensure the required modals/components are in the page markup and their references are assigned before actions run.
- For Permissions modal: include the component and capture @ref, then call it.
- For user Sessions and View Details actions: ensure the Identity module’s built-in modals are placed on the page with @ref or keep the actions that open these modals in sync with the component names/refs.
- Do not conditionally render these modal components based only on permissions; render them unconditionally (or ensure the conditions are true when actions are visible). The action visibility and component presence must match.
Concrete example for a customized Users page (pattern you can adopt for Sessions/View Details too):
@using Volo.Abp.PermissionManagement.Blazor.Components <MudDataGrid T="IdentityUserDto" @ref="_dataGrid" ServerData="LoadServerData"> <!-- ...columns... --> <Columns> <MudBlazor.Column T="IdentityUserDto" Field="@nameof(IdentityUserDto.Id)" Title="@L["Actions"]"> <CellTemplate> <MudIconButton Icon="fas fa-user-lock" OnClick="@(async (_) => await OpenPermissionsModalAsync(context.Item))" Size="MudBlazor.Size.Small" /> <MudIconButton Icon="fas fa-list" OnClick="@(async (_) => await OpenSessionsAsync(context.Item))" Size="MudBlazor.Size.Small" /> <MudIconButton Icon="fas fa-eye" OnClick="@(async (_) => await OpenViewDetailsAsync(context.Item))" Size="MudBlazor.Size.Small" /> </CellTemplate> </MudBlazor.Column> </Columns> </MudDataGrid> <!-- Place required modals and capture refs --> <MudPermissionManagementModal @ref="_permissionManagementModal" /> <UserSessionsModal @ref="_sessionsModal" /> <UserViewDetailsModal @ref="_viewDetailsModal" />And in code-behind:
private MudPermissionManagementModal _permissionManagementModal; private UserSessionsModal _sessionsModal; private UserViewDetailsModal _viewDetailsModal; protected virtual async Task OpenPermissionsModalAsync(IdentityUserDto entity) { await _permissionManagementModal.OpenDialogAsync(PermissionProviderName, entity.Id.ToString()); } protected virtual async Task OpenSessionsAsync(IdentityUserDto entity) { // Ensure _sessionsModal is not null await _sessionsModal.OpenAsync(entity.Id); } protected virtual async Task OpenViewDetailsAsync(IdentityUserDto entity) { await _viewDetailsModal.OpenAsync(entity.Id); }If you replaced/overrode the default Identity Users page:
- Verify the component names used by the action handlers match the actual components you render (e.g., if the module uses SessionsModal/ViewDetailsModal, either include those or update the handlers to your custom components).
- Ensure no @if guards hide the modal components while the action buttons are visible. A common pitfall is wrapping modal components in “HasManagePermissionsPermission” or similar, resulting in null refs when the action is still available.
For Interactive Auto/Server:
- Avoid referencing components before first render. Keep modal open calls inside event handlers (after first render), and ensure fields are assigned via @ref at render time.
- If you must conditionally render, also conditionally show actions to keep consistency.
- Sources
- https://abp.io/docs/latest/framework/ui/blazor/overall
- https://github.com/abpframework/abp
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
Thanks. I will check and fix it. 👍
-
0
hi
This exception happens if the current user has session permission but has not updated the permission.
We will fix it in the next patch version.
Your Question Credits have been refunded.
Thanks.