.net ExternalSigninAsync MissingMethodException System.Threading.tasks
<p>I am attempting to sign a user into my site through Google. The Google signin works correctly, but I am getting a MissingMethodException in the AccountController method on the line:</p>

<pre><code>var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
</code></pre>

<p>The error is: </p>

<pre><code>Method not found: 'System.Threading.Tasks.Task`1&lt;!!0&gt; System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(System.Linq.IQueryable`1&lt;!!0&gt;, System.Linq.Expressions.Expression`1&lt;System.Func`2&lt;!!0,Boolean&gt;&gt;)'.
</code></pre>

<p>I have tried using System.Threading.Tasks in the AccountController. I've also looked for other places I could be using System.Threading.Tasks and tried to put it in there. </p>

<p><strong>Question:</strong> What is causing this error, and how can it be fixed?</p>

<p>Here is the whole method that contains that line:</p>

<pre><code>[AllowAnonymous]
public async Task&lt;ActionResult&gt; ExternalLoginCallback(string returnUrl)
{
    var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
    if (loginInfo == null)
    {
        return RedirectToAction("Login");
    }
    // Sign in the user with this external login provider if the user already has a login
    var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
    switch (result)
    {
        case SignInStatus.Success:
            return RedirectToLocal(returnUrl);
        case SignInStatus.LockedOut:
            return View("Lockout");
        case SignInStatus.RequiresVerification:
            return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
        case SignInStatus.Failure:
        default:
            // If the user does not have an account, then prompt the user to create an account
            ViewBag.ReturnUrl = returnUrl;
            ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
            return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
    }
}
</code></pre>

<p><strong>Update</strong>
With the advice of several commenters I have been trying to find out what's going on with Fusion Log but am still having trouble finding it. To be specific, I did the following: I set the ForceLog and LogFailures to 1 in the FusionLog registry, and gave it a directory. Then I built the website at 11:59, then waited a few minutes before I attempted to log into Google, which I did at 12:03. </p>

<p>I got a ton of logs for the original build, some of which had failures in it. But the site did build, so those must not have been fatal failures, I think. But when I actually tried to log in I only got a few logs, all of which operations are successful. 
<a href="https://i.stack.imgur.com/yaFoI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yaFoI.png" alt="Log Files sorted by Date"></a></p>

<p><a href="https://i.stack.imgur.com/LnWQS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LnWQS.png" alt="enter image description here"></a></p>

<p>I won't list the full fusion logs, but here's a list of assemblies that never succeeded in binding on the original build:</p>

<ul>
<li>Microsoft.VisualStudio.Web.PageInspector.Runtime</li>
<li>iisexpresstray.resources</li>
</ul>

<p>Could either of these have led to this error?</p>

<p><strong>Update 2</strong>
Looking at other logs, I think that WebpageInspector.Runtime did successfully bind eventually. The only thing theat never bout was iisexpresstray.resources, but according to a blog about Fusion Log, I read that: "Unless you are explicitly debugging the failure of a resource to load, you will likely want to ignore failures to find assemblies with the “.resources” extension with the culture set to something other than “neutral”. Those are expected failures when the ResourceManager is probing for satellite assemblies." So now I really don't know what the failure is. </p>

<p><strong>Update 3</strong>
Other things that didn't work</p>

<ul>
<li>reinstalling all packages</li>
<li>cleaning and rebuilding the solution</li>
</ul>

<p><strong>Update 4</strong>
Mike Barry informed me that .net40 can't do async operations, so if any of my references refer to the .net40 version of a file then it won't work. I think my EntityFramework refers to the .net 40 version of the file, because the folder it refers to is <code>[PROJECT PATH]\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</code>. But I cannot get it to refer to <code>[PROJECT PATH]\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</code> no matter what I do. All my references in my properties and .csproj file refer to .net4.5 but when I uninstall and reinstall EntityFramework it stubbornly goes back to the .net40 folder. </p>

<p><a href="https://i.stack.imgur.com/CKRWn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CKRWn.png" alt="Current Visual Studio and NuGet version"></a></p>

<p><strong>Update 5</strong></p>

<p>I used a try-catch to get all the information about the exception. Here is what I got:</p>

<pre><code>Exception System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1&lt;!!0&gt; System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(System.Linq.IQueryable`1&lt;!!0&gt;, System.Linq.Expressions.Expression`1&lt;System.Func`2&lt;!!0,Boolean&gt;&gt;)'.
   at Microsoft.AspNet.Identity.EntityFramework.UserStore`6.&lt;FindAsync&gt;d__23.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine&amp; stateMachine)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine&amp; stateMachine)
   at Microsoft.AspNet.Identity.EntityFramework.UserStore`6.FindAsync(UserLoginInfo login)
   at Microsoft.AspNet.Identity.UserManager`2.FindAsync(UserLoginInfo login)
   at Microsoft.AspNet.Identity.Owin.SignInManager`2.&lt;ExternalSignInAsync&gt;d__1d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at LangSite_151209.Controllers.AccountController.&lt;ExternalLoginCallback&gt;d__3a.MoveNext() in c:\Users\Administrator\Source\Workspaces\Lang Site 4.12\DEV\Controllers\AccountController.cs:line 342
 data = System.Collections.ListDictionaryInternal
 helplink = 
 hrresult = -2146233069
 innerexception = 
 message = Method not found: 'System.Threading.Tasks.Task`1&lt;!!0&gt; System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(System.Linq.IQueryable`1&lt;!!0&gt;, System.Linq.Expressions.Expression`1&lt;System.Func`2&lt;!!0,Boolean&gt;&gt;)'.
 source = Microsoft.AspNet.Identity.EntityFramework
 stacktrace =    at Microsoft.AspNet.Identity.EntityFramework.UserStore`6.&lt;FindAsync&gt;d__23.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine&amp; stateMachine)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine&amp; stateMachine)
   at Microsoft.AspNet.Identity.EntityFramework.UserStore`6.FindAsync(UserLoginInfo login)
   at Microsoft.AspNet.Identity.UserManager`2.FindAsync(UserLoginInfo login)
   at Microsoft.AspNet.Identity.Owin.SignInManager`2.&lt;ExternalSignInAsync&gt;d__1d.MoveNext()
</code></pre>

<p>Soma Yarlaggadda asked to see my packages.config, so here it is:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;packages&gt;
  &lt;package id="Antlr" version="3.5.0.2" targetFramework="net451" /&gt;
  &lt;package id="EntityFramework" version="6.1.3" targetFramework="net451" /&gt;
  &lt;package id="jQuery" version="2.2.3" targetFramework="net451" /&gt;
  &lt;package id="jQuery.Validation" version="1.15.0" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net451" /&gt;
  &lt;package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" /&gt;
  &lt;package id="Modernizr" version="2.8.3" targetFramework="net451" /&gt;
  &lt;package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" /&gt;
  &lt;package id="Owin" version="1.0" targetFramework="net451" /&gt;
  &lt;package id="Respond" version="1.4.2" targetFramework="net451" /&gt;
  &lt;package id="WebGrease" version="1.6.0" targetFramework="net451" /&gt;
&lt;/packages&gt;
</code></pre>

<p><strong>FINAL UPDATE:</strong> Never did get this solved. 50 rep down the drain for the bounty. I ended up just making a new site from scratch and moving my content in there. </p>