Assume the following code:
private async Task Test1Async() => await Task.Delay(1000).ConfigureAwait(false);
private Task Test2Async() => Test1Async();
Functionally, these functions are exactly the same, but the compiler considers calling these methods different. The following code compiles, but issues warning CS4014:
private void Test() => Test1Async();
It generates a warning "because this call is not expected, the current method continues to be executed until the call ends." This is a valid warning, because it often indicates a flaw in your code. If you really want this behavior, you can solve it using the following code:
private void Test() => _ = Test1Async();
Assigning a value _is a relative new function, indicating that the value is ignored intentionally.
This code does not raise CS4014:
private void Test() => Test2Async();
, , async/await, , (- , async). , , , ( , async).
.
- , , Task, async?