ASP.NET Core 2.1 displaying users and roles

Trying to display users along with their role in core 2.1, I followed the example&nbsp;<a href="https://stackoverflow.com/questions/51004516/net-core-2-1-identity-get-all-users-with-their-associated-roles" target="_blank">stackoverflow</a>&nbsp;. I have no errors but I'm not getting user roles to display. I think it could be my view, for some reason my code returns an email address instead of user role.

Trying to display users along with their role in core 2.1, I followed the example stackoverflow . I have no errors but I'm not getting user roles to display. I think it could be my view, for some reason my code returns an email address instead of user role.

ApplicationDbContext

public class ApplicationDbContext : IdentityDbContext<ApplicationUser, 
ApplicationRole, string, IdentityUserClaim<string>,
ApplicationUserRole, IdentityUserLogin<string>,
IdentityRoleClaim<string>, IdentityUserToken<string>>

{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}

protected override void OnModelCreating(ModelBuilder builder)
{
    base.OnModelCreating(builder);

    builder.Entity&lt;ApplicationUserRole&gt;(userRole =&gt;
    {
        userRole.HasKey(ur =&gt; new { ur.UserId, ur.RoleId });

        userRole.HasOne(ur =&gt; ur.Role)
            .WithMany(r =&gt; r.UserRoles)
            .HasForeignKey(ur =&gt; ur.RoleId)
            .IsRequired();

        userRole.HasOne(ur =&gt; ur.User)
            .WithMany(r =&gt; r.UserRoles)
            .HasForeignKey(ur =&gt; ur.UserId)
            .IsRequired();
    });
}

public DbSet&lt;ApplicationUser&gt; ApplicationUser { get; set; }

}

Startup.cs

services.AddIdentity<ApplicationUser, ApplicationRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();

ApplicationUser

public class ApplicationUser : IdentityUser
{
public ICollection<ApplicationUserRole> UserRoles { get; set; }

public class ApplicationUserRole : IdentityUserRole&lt;string&gt;
{
    public virtual ApplicationUser User { get; set; }
    public virtual ApplicationRole Role { get; set; }
}
public class ApplicationRole : IdentityRole
{
    public ICollection&lt;ApplicationUserRole&gt; UserRoles { get; set; }
}

}

Index method:

public async Task<IActionResult> Index(int? page )
{
var users = from u in _userManager.Users.Include(u => u.UserRoles).ThenInclude(ur => ur.Role) select u;

return View(users.ToPagedList(pageNumber, pageSize));
}

View

@Html.DisplayFor(m => item.UserRoles)


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

What’s new in HTML6

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Asp.Net Core MVC Bangla Tutorials -06 (Complete eCommerce Application)

Asp.Net Core MVC Bangla Tutorials -06 (Complete eCommerce Application)

LIKE | COMMENT | SHARE | SUBSCRIBE Areas are an ASP.NET feature used to organize related functionality into a group as a separate namespace (for routing) and...

Asp.Net Core MVC Bangla Tutorials - 46 (Complete eCommerce Application)

Asp.Net Core MVC Bangla Tutorials - 46 (Complete eCommerce Application)

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, you will learn how to use your C# coding prowess to set up the session state in your ASP.NET Core and MV...

Asp.Net Core MVC Bangla Tutorials - 47 (Complete eCommerce Application)

Asp.Net Core MVC Bangla Tutorials - 47 (Complete eCommerce Application)

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, you will learn how to use your C# coding prowess to set up the session state in your ASP.NET Core and MV...