C# Error with null-conditional operator and await
You can add ?? Operator so if ?. returns null task use CompletedTask instead. await (this.MyObject?.MyMethod() ?? Task.CompletedTask) I would’ve expected that the call to “MyMethod” would simply not be made if “MyObject” is null. Thats true. the ?. operator returns null task instead of calling MyMethod. the null reference exception is made because you … Read more