Open jinweijie opened 7 years ago
The method is marked with async
, so the null
return is already a Task
. The compiler does this.
Thanks Allen, but at runtime, an exception was thrown. I was using .Net framework 4.6.1. After I changing null with Task.FromResult
because the return type is Task, so we should return Task.FromResult(null) instead of null. Otherwise, null exception will be raised.