How to download files using UWP in c#
<p>I'm a beginner in programming, and I was wondering what the right way is to download files in UWP I now use this, but it only works like 50% of the time:</p>

<pre><code>public async Task StartDownload()
{
    try
    {
        StorageFile sf = await DownloadsFolder.CreateFileAsync(title.Text, CreationCollisionOption.GenerateUniqueName);
        downloadFolder = (await sf.GetParentAsync()).ToString();
        HttpClient client = new HttpClient();
        byte[] buffer = await client.GetByteArrayAsync(inputURL);
        using (Stream stream = await sf.OpenStreamForWriteAsync())
        {
            stream.Write(buffer, 0, buffer.Length);
        }
        path = sf.Path;
    }
    catch (Exception e)
    {
        MessageDialog dialog = new MessageDialog("Sorry, something went wrong...", "An error...");
        await dialog.ShowAsync();
    }
}
</code></pre>

<p>The exception is:
"Unhandled exception at 0x750F6D7E (combase.dll in program.exe 0xC000027B;
An application-internal exception has occurred (parameters: 0x16E73128, 0x00000001)."</p>

<p>Thanks in advance</p>