Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

I can't get my Task to execute!

$
0
0

New to this so be kind. I have tried to write a Task<> that can be awaited:

        Task<bool> RenderAsync(string ReportName)
        {

            return new Task<bool>(() =>
                {
                        return Render(ReportName);
                }
            );

        }

I execute this from a method declared async with the following:

await RenderAsync(TheReport);

The app compiles without errors and the RenderAsync is called and returns as I would have expected. However, the code within the Lambda never runs and the Render method and it is never called. What am I missing?

Michael


Michael


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>