I have this this code
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password)
I want this code piece to run Synchronously, because my very next statement is depend upon this. Below call fails most of the time because user is null.
var roles = await userManager.GetRolesAsync(user.Id);
Any suggestion?
But if the context user just is null, it won't help you if you do it synchronously - user will be just as NULL as it was before.
If you are trying to add a login to your application, it might help to check out this.
Also, you should probably use policies instead of roles.
Edit:
OK, without deadlock-problem I was unaware of (thanks @hvd):
If the async method returns void