You don't need to use ContinueWith
when you are using await
, the rest of the method gets automatically registered as a continuation. You should be able to just do:
try
{
var result = await insert.UploadAsync();
}
catch(Exception ex)
{
Console.WriteLine("Upload Filed. " + ex.Message);
}
finally
{
Logger.Debug("Closing the stream");
uploadStream.Dispose();
Logger.Debug("The stream was closed");
}
This link explains a bit more about async\await