Solution :
The method named myWebClient.DownloadStringTaskAsync runs on a separate thread and also it is non-blocking. A possible solution is to DownloadDataCompleted event handler for myWebClient and a SemaphoreSlim class field.
e.g.
private SemaphoreSlim signalDownloadComplete = new SemaphoreSlim(0, 1);
private bool isDownloading = false;
....
//Adding to DownloadAsync() method
myWebClient.DownloadDataCompleted += (s, e) => {
isDownloading = false;
signalDownloadComplete.Release();
}
isDownloading = true;
...
//Adding to block main calling method from returning until download is completed
if (isDownloading)
{
await signalDownloadComplete.WaitAsync();
}
This will resolve your issue