v9 Async method not decompiled

slaneyrwslaneyrw Posts: 46
edited January 14, 2016 5:40PM in .NET Reflector Previous Versions
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&lt;IdentityResult&gt; AddClaimsAsync(string userId, IEnumerable&lt;Claim&gt; claims, IEqualityComparer&lt;Claim&gt; existingMatcher = null)
        {
            IUserClaimStore&lt;ApplicationUser, string&gt; claimStore = this.Store as IUserClaimStore&lt;ApplicationUser, string&gt;;

            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 =&gt; existingClaims.Where(existing =&gt; 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
&#91;AsyncStateMachine(typeof(&lt;AddClaimsAsync&gt;d__2)), DebuggerStepThrough&#93;
public Task&lt;IdentityResult&gt; AddClaimsAsync(ApplicationUser user, IEnumerable&lt;Claim&gt; claims, IEqualityComparer&lt;Claim&gt; existingMatcher = null)
{
    &lt;AddClaimsAsync&gt;d__2 stateMachine = new &lt;AddClaimsAsync&gt;d__2 {
        &lt;&gt;4__this = this,
        user = user,
        claims = claims,
        existingMatcher = existingMatcher,
        &lt;&gt;t__builder = AsyncTaskMethodBuilder&lt;IdentityResult&gt;.Create(),
        &lt;&gt;1__state = -1
    };
    stateMachine.&lt;&gt;t__builder.Start&lt;&lt;AddClaimsAsync&gt;d__2&gt;(ref stateMachine);
    return stateMachine.&lt;&gt;t__builder.Task;
}
Sign In or Register to comment.