c# - HttpClientt.SendAsync doesnt wait/lock execution -
var httpresponsemessage = await httpclient.sendasync(message).configureawait(false); var datastream = await httpresponsemessage.content.readasstreamasync(); this idea should awaited, no matter executions exists method , returns ui. execution resumes when responses arrives, time ui has updated execution finished, when in fact hasn't. calling methods awaited. initial method not awaited design (task.run(() => startdownload(selectedschedules)); starts ui method executing services triggers httpclient, when call finished ui should update progress, second httpclient.sendasync is executed, execution returns ui task.run(() => startdownload(selectedschedules)); //first call, initiated button public async task startdownload(scheduleslist list) { //var t = new task(() => _scheduleservices.download(list)); //t.start(); //await t; await _scheduleservices.downloadiwcfdb(list, usbinfomodels); } public async task download(scheduleslist scheduleslist) { ...