Async await in minimal API

Hey guys, I have a minimal API app which also hosts a client which has a websocket connection.
The websocket gets in a disconnect state a lot so I reconnect if I can't get the data I want.

However, it seems like the await for the reconnect isn't properly awaited, is there some special async/await mechanics in these minimal API routed calls?

Code:

app.MapGet("/account", async Task<Results<Ok<AccountOverview>, NoContent>>
    () =>
    {
        try
        {
            await _client.GetAccount();
        }
        catch
        {
            _client.Reconnect().Wait();
            await _client.Authenticate();
            await _client.GetAccount();
        }
    ...
    }
);

I've tried with both .Wait and await for the reconnect call.
Was this page helpful?