async/await support in Util.OnDemand - datagrid
Hi,
Please review the following snippet. The async/await call in Util.OnDemand results to 'Task`1' - is this to be expected or should the actual value 'Result' appear in the data grid column?
// OK: Result = Result
new[] { Task.Run(async () => await Task.FromResult("Result")) }.Dump(true);
// NOK - Result = Task`1
new[] { Util.OnDemand("Click", async () => await Task.FromResult("Result")) }.Dump(true);
// OK - Result = Result
new[] { Util.OnDemand("Click", () => Task.Run(async () => await Task.FromResult("Result")).GetAwaiter().GetResult()) }.Dump(true);

Version 9.8.12
Best Answer
-
This is correct - the lazy value returns a Task.
