Getting Started with Asynchronous Programming in .NET
Use Async Void
protected async void search_click( object sender, RouteEventArgs e)
Async Void is only appropriate for Event Handler
{
await GetStocks()
}
Alternate Solution
private async Task GetStock()
{
}
Take Away:
Async Void crashes an application or may results in 500 exception if something went wrong. As there is no way to propagate exception even you have proper try catch.
Call GetStock()
private async void GetStock()
{
try
{}
catch()
}
Take Away:
Async Void crashes an application or may results in 500 exception if something went wrong. As there is no way to propagate exception even you have proper try catch.
Call GetStock()
private async void GetStock()
{
try
{}
catch()
}
No comments :
Post a Comment