Explore Library
Code Quiz

Awaiting the async model correctly

Spot the subtle async/await mistake that causes incomplete work and lost exceptions.

Codecsharp
public async Task<string> GetUserNameAsync(int id)
{
    using (var client = new HttpClient())
    {
        var response = client.GetStringAsync($"https://api.example.com/users/{id}");
        return response.Substring(0, 10);
    }
}

What is the bug in this async method?