title: Method not found: 'System.Reflection.MethodInfo Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.get_SelectAsyncMethod()'
body: <p>People I need help I am in a new project in which I am implementing identity server 4 and I am trying to recover the previously created users with asp.Identity that I have in my database to be able to verify when I make an external login from identity server 4. Sorry my english.
  My Startup.cs</p>
  
  <pre><code>public class Startup
  {    
  
  public IConfiguration Configuration { get; }
  
  public Startup(IConfiguration configuration)
  {
      Configuration = configuration;
  }
  
   public void ConfigureServices(IServiceCollection services)
  {
      #region --Identity ASP
  
      services.AddDbContext&lt;QGoodDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")),ServiceLifetime.Transient);
      services.AddIdentity&lt;ApplicationUser, ApplicationRole&gt;()
              .AddEntityFrameworkStores&lt;QGoodDbContext&gt;()                   
              .AddDefaultTokenProviders();
  
      #endregion
  
      services.AddMvc();
  
      services.AddScoped&lt;UserManager&lt;ApplicationUser&gt;&gt;();
      services.AddScoped&lt;SignInManager&lt;ApplicationUser&gt;&gt;();
  
      // configure identity server with in-memory stores, keys, clients and scopes
      services.AddIdentityServer()
              .AddDeveloperSigningCredential()
              .AddInMemoryPersistedGrants()
              .AddInMemoryIdentityResources(Config.GetIdentityResources())
              .AddInMemoryApiResources(Config.GetApiResources())
              .AddInMemoryClients(Config.GetClients());
              //.AddAspNetIdentity&lt;ApplicationUser&gt;();
          }
  }
  </code></pre>
  
  <p>When I initialize my database I already have this error</p>
  
  <pre><code> public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {          
  
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseIdentityServer();
              app.UseStaticFiles();
              app.UseMvcWithDefaultRoute();
              InitializeDatabase(app);
          }
  
          private void InitializeDatabase(IApplicationBuilder app)
          {
              using (var serviceScope = app.ApplicationServices.GetService&lt;IServiceScopeFactory&gt;().CreateScope())
              {
                  //serviceScope.ServiceProvider.GetRequiredService&lt;QGoodDbContext&gt;().Database.Migrate();
  
                  var context = serviceScope.ServiceProvider.GetRequiredService&lt;QGoodDbContext&gt;();
  
              }
          }
  </code></pre>
  
  <p>In my <code>AccountController</code> i have exception when call  <code>await _userManager.FindByLoginAsync(provider, providerUserId);</code> </p>
  
  <pre><code> public class AccountController : Controller
      {
          private readonly UserManager&lt;ApplicationUser&gt; _userManager;
          private readonly SignInManager&lt;ApplicationUser&gt; _signInManager;
          private readonly QGoodDbContext _context;
          private readonly TestUserStore _users;
          private readonly IIdentityServerInteractionService _interaction;
          private readonly IClientStore _clientStore;
          private readonly IAuthenticationSchemeProvider _schemeProvider;
          private readonly IEventService _events;
  
  
          public AccountController(
              UserManager&lt;ApplicationUser&gt; userManager,
              SignInManager&lt;ApplicationUser&gt; signInManager,
              QGoodDbContext context,
              IIdentityServerInteractionService interaction,
              IClientStore clientStore,
              IAuthenticationSchemeProvider schemeProvider,
              IEventService events,
              TestUserStore users = null)
          {
              // if the TestUserStore is not in DI, then we'll just use the global users collection
              // this is where you would plug in your own custom identity management library (e.g. ASP.NET Identity)
              _users = users ?? new TestUserStore(TestUsers.Users);
              _userManager = userManager;
              _signInManager = signInManager;
              _context = context;
              _interaction = interaction;
              _clientStore = clientStore;
              _schemeProvider = schemeProvider;
              _events = events;
          }
            public async Task&lt;IActionResult&gt; ExternalLoginCallback()
          {
              try
              {
                  // read external identity from the temporary cookie
                  var result = await HttpContext.AuthenticateAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme);
                  if (result?.Succeeded != true)
                  {
                      throw new Exception("External authentication error");
                  }
  
                  // lookup our user and external provider info
                  var (userTest, provider, providerUserId, claims) = FindUserFromExternalProvider(result);
                  var user = await _userManager.FindByLoginAsync(provider, providerUserId);
              }
          }
      }
  </code></pre>
  
  <p>Exception is: </p>
  
  <blockquote>
    <p>Method not found: 'System.Reflection.MethodInfo Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.get_SelectAsyncMethod()'</p>
  </blockquote>