Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Exceptions in Updater #407

Open
bruce965 opened this issue Feb 25, 2018 · 0 comments
Open

Async Exceptions in Updater #407

bruce965 opened this issue Feb 25, 2018 · 0 comments

Comments

@bruce965
Copy link

bruce965 commented Feb 25, 2018

Asynchronous methods do not throw exceptions, you should await for a result instead.

private void MainForm_Load(object sender, EventArgs e)
{
	// ...

	try
	{
		webClient.DownloadFileAsync(new Uri("https://github.com/PeterTh/gedosato/archive/master.zip"), "update.zip");
	}
	catch (Exception ex)
	{
		// ..
	}
}

Should be changed to:

private async Task MainForm_Load(object sender, EventArgs e)
{
	// ...

	try
	{
		await webClient.DownloadFileAsync(new Uri("https://github.com/PeterTh/gedosato/archive/master.zip"), "update.zip");
	}
	catch (Exception ex)
	{
		// ..
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant