I am writting a middleware for Asp.Net Identity UserStore where the caller expects a Task and the Method to be called is NonAsynch.
Task IUserSecurityStampStore<T, string>.SetSecurityStampAsync(T user, string stamp)
{
var res = Utility.SetSecurityStamp(user, stamp); // needs to be called as Async
var identityUser = ToIdentityUser(res);
SetApplicationUser(user, identityUser);
return ??? ; // How do i get a task to return here ?
}
How do i return a Task out of res and stamp? Tried Task.FromResult but it says only one type argument is allowed.
Task.FromResultis the solution (if it is the case you may want to edit your question to make it clear that you need synchronous method to be compatible with async siganture/beawait-able)