Description
We have plenty of code like below:
async IAsyncOperation<T> Foo()
{
return await AsyncInfo.Run(async () =>
{
// no await in the body at all
return foo;
});
}
which doesn't actually await anything in an async method. Instead, we should rewrite them to
IAsyncOperation<T> Foo()
{
return Task.FromResult(foo).AsAsyncOperation();
}
This can avoid unnecessary async state machine be generated to reduce GC pressure.
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done