c# - Function Running Sync When VS Says it should be running async -
why b run sync? vs says ."because call not awaited, execution of current method continues before call completed." ; a) task.factory.startnew(() => funcation(1, 1)); //runs async b) funcation(1, 1); // says runs async in vs, runs sync. c) var handleone = task.run(() => { funcation(1, 1); }); // runs async d) await task.factory.startnew(() => funcation(1, 1)); //awaits correctly e) await funcation(1, 1); //awaits correctly static private async task<int> funcation(int x, int y) { task.delay(1000).wait(); } the funcation using async keyword not await in it's body run synchronously. function not compile. a) task.factory.startnew(() => funcation(1, 1)); //runs async here create thread , on thread call function asynchrounsly because running on thread. b) funcation(1, 1); function marked async not await ed invoked. in case compiler not check whether function using await in it's body...