In the earlier versions of C# , there was no provision to have the await keyword in catch and finally block . This was a kind of limitation and developers had to use a workaround to get this to work.
In C# 6.0 , the await can now be used within the the catch and finally block.
Await in Catch and finally block in C# 6.0
WebClient client = null;
try
{
client = new WebClient();
string response = await client.DownloadStringTaskAsync(new Uri("http://developerpublish.com"));
Console.WriteLine(response);
}
catch (Exception e)
{
// Logging Logic
await Logger.LogAsync(client, e);
}
finally
{
}