Asynchronous controllers don't get looping / dont get called

I recently tried to "update" my controllers to use asynchronous methods. Now every time I try to access anything that has an asynchronous signature it just keeps loading endlessly

Here's a controller as an example:

public async Task<ActionResult> Index()
{
    _usersLogic = new UsersLogic(User.Identity.Name);
    return View(await _usersLogic.get());
}

      

A function to call if you want to assume the problem is in my code

private string user;

public UsersLogic(user)
{
    this.user = user;
}

public async Task<Agent> Get()
{
    return await Context.Users.FirstOrDefaultAsync(i => i.ID == user);
}

      

What could be causing this? Any builds that went wrong? What is this magic that keeps my threads waiting forever?

+3


source to share


1 answer


You are using Result

in a code snippet that is not shown here. This is deadlocked in ASP.NET.



+3


source







All Articles