Sep 24, 2019 03:00 AM|Rena Ni|LINK
InvalidCastException: Unable to cast object of type 'System.Threading.Tasks.Task`1[System.Collections.Generic.IList`1[System.String]]'
to type 'System.Collections.Generic.IList`1[System.String]'
After debugging step by step,I find the error made in this line:var roles =_utilities.GetLoggedUserGroup();
So you need to change your EventoSistema action like below:
public async Task<IActionResult> EventoSistema()
_utilities.AddSystemEvent("Exception message", "Exception type", "Exception stack");
var roles =await _utilities.GetLoggedUserGroup();
ViewBag.roles = roles;
And you need to modify the view if you want to show the role in your view:
foreach (string item in roles)
I have, in fact, found a video tutorial that covers this approach. I am adding the link for such tutorial as a reference in case someone else needs it.
If you have resolve the issue,you could mark the solution or anyone's helpful answer to close the thread.It would also help others.