Displaying roles for user in C# .Net Core

In my code I have
var roles1 = claims.Where(c => c.Type == ClaimTypes.Role).ToArray();

in the view
@foreach (var city in ViewBag.roles) {
@city.role

}

I get nothing back and no errors. I know I have roles with the current user because authorization for the views is working correctly. I am a bit confused.

As it has been more than a few months since this topic was opened, and there has been no reply or further information provided as to the existence of the issue, we are closing this topic. Please don’t hesitate to create a new topic if this issue is still present, we would be happy to work with you to help find a resolution.