I'm getting the async state machine initialisation when viewing an async method instead of the code. This is a method sitting inside a class that inherits from Microsoft.AspNet.Identity.UserManager<ApplicationUser>
VS2015 update 1
Targeting .NET 4.6
I have ASP.NET 5 RC1 installed, but project is an ASP.NET 4 project ( i.e. .csproj )
Original
public async Task<IdentityResult> AddClaimsAsync(string userId, IEnumerable<Claim> claims, IEqualityComparer<Claim> existingMatcher = null)
{
IUserClaimStore<ApplicationUser, string> claimStore = this.Store as IUserClaimStore<ApplicationUser, string>;
ApplicationUser user = await this.FindByIdAsync(userId).WithCurrentCulture();
if (user == null)
{
throw new InvalidOperationException("UserId not found.");
}
var matcher = existingMatcher ?? Framework.Claims.ClaimComparers.ClaimTypeIssuerAndValue;
var existingClaims = await claimStore.GetClaimsAsync(user).WithCurrentCulture();
var existingToRemove = claims.SelectMany(claim => existingClaims.Where(existing => matcher.Equals(claim, existing))).ToList();
foreach(Claim claim in existingToRemove)
{
await claimStore.RemoveClaimAsync(user, claim).WithCurrentCulture();
}
foreach (Claim claim in claims)
{
await claimStore.AddClaimAsync(user, claim).WithCurrentCulture();
}
return await this.UpdateAsync(user).WithCurrentCulture();
}
Decompiled
[AsyncStateMachine(typeof(<AddClaimsAsync>d__2)), DebuggerStepThrough]
public Task<IdentityResult> AddClaimsAsync(ApplicationUser user, IEnumerable<Claim> claims, IEqualityComparer<Claim> existingMatcher = null)
{
<AddClaimsAsync>d__2 stateMachine = new <AddClaimsAsync>d__2 {
<>4__this = this,
user = user,
claims = claims,
existingMatcher = existingMatcher,
<>t__builder = AsyncTaskMethodBuilder<IdentityResult>.Create(),
<>1__state = -1
};
stateMachine.<>t__builder.Start<<AddClaimsAsync>d__2>(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
VS2015 update 1
Targeting .NET 4.6
I have ASP.NET 5 RC1 installed, but project is an ASP.NET 4 project ( i.e. .csproj )
Original
Decompiled