Try this.
using (ApplicationDbContext db = new ApplicationDbContext())
{
IdentityRole myRole= db.Roles.First(r => r.Name == roleName);
Int32 count = db.Set<IdentityUserRole>().Count(r => r.RoleId == myRole.Id);
return count;
}