I can't get my Task<> to execute!


new kind. have tried write task<> can awaited:

        task<bool> renderasync(string reportname)          {                return new task<bool>(() =>                  {                          return render(reportname);                  }              );            }

i execute method declared async following:

await renderasync(thereport);

the app compiles without errors , renderasync called , returns have expected. however, code within lambda never runs , render method , never called. missing?

michael


michael

you're not starting task:

task<bool> renderasync(string reportname) {     var task = new task<bool>(() => {         return render(reportname);     });     task.start();     return task; }

or simpler:

task<bool> renderasync(string reportname) {     return new task.run(() => {         return render(reportname);     }); }



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'