I'm currently porting a site to ASP.NET Core 2 and am getting the following Exception thrown when I call userManager.GenerateEmailConfirmationTokenAsync(user) with a user class that extends IdentityUser<Guid>:
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at System.IO.BinaryWriter.Write(String value)
at Microsoft.AspNetCore.Identity.DataProtectorTokenProvider`1.<GenerateAsync>d__11.MoveNext()
GenerateAsync() makes a call to UserManager.GetUserIdAsync(), which is returning the null value in Result, which Write() is complaining about, even though the User instance I'm passing through has 07c0423e-f36b-1410-8007-800000000000 in Id.
If I call userManager.GetUserIdAsync(user) directly on the same UserManager instance on which I'm calling GenerateEmailConfirmationTokenAsync() I get this same null value in Result.
Does anyone have any ideas how to resolve this?
Edit: As requested, a functional example can be found at github.com/BenjaminNolan/GetUserIdAsyncNullExample