Skip to content

Unhandled Exception in IAuthRolesAdminService.UpdateRoleToPermissionsAsync() when a RoleType change is detected #124

Description

@ccnicholls99

If you pass in a set of Permissions that would force a change of RoleType, you get a System.NullReferenceException: Object reference not set to an instance of an object.

The exception occurs in AuthPermissions.AdminCode.Services.Internal.ChangeRoleTypeChecks.CheckRoleTypeChangeAsync, Line 102, where the method UserErrorMessageAsync is called. The var formattableString is expecting an instance but is getting null instead.

private async Task<FormattableString> UserErrorMessageAsync(string roleName, bool filterOutNonTenantUsers) {
    ...logic omitted...
    return (num > 0) ? ((FormattableString)$"{num} users are linked to it.") : null;
}

Installed NuGet AuthPermissions.AspNetCore, Version: 9.0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions