c# - Multiple await's inside an async method -


i have method

public async void getresult () 

that relies on 2 await responses inside of it.

this 1st: await:

await system.threading.tasks.task.factory.startnew (() => {                      try                      {                         scanneditem = getscanneditem();                      }                     catch (exception exe)                      { } 

and 2nd await await call uses scanneditem above

await system.threading.tasks.task.factory.startnew (() => {                      try                     {                         getresultsscanneditem = results(scanneditem);                      }                     catch (exception exe)                      { } 

i want have execute 1 button. however, second await never gets executed. can have 2 awaits inside method? bit confused on how go doing this.

yes can have multiple awaits inside single method .. these don't awaitable tasks .. wrapping them task factory.

you seem swallowing whatever exception happening within code.

try changing to:

await task.run(() => scanneditem = getscanneditem());  await task.run(() => getresultsscanneditem = results(scanneditem)); 

step through debugger , see if running or exception happening.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -