Closed gbraad closed 3 years ago
A warning is shown on build about the call not being awaited. However, this is not something that is needed in case of the telemetry calls. Either we can choose to use pragma directives, such as:
#pragma warning disable 4014 SomeAsyncMethod(); #pragma warning restore 4014
or in the chosen case, just use
_ = SomeAsyncMethod();
to discard the return value.
Not only does this suppress the warning, but it also more clearly indicate the intent that the call is not awaited.
SomeAsyncMethod().NoAwait();
@anjannath WDYT?
@gbraad Sorry about the delay, looks good to me 👍🏽
Refactor: suppress await/async warning
A warning is shown on build about the call not being awaited. However, this is not something that is needed in case of the telemetry calls. Either we can choose to use pragma directives, such as:
or in the chosen case, just use
to discard the return value.
Refactor: add extension method to show NoAwait intent
Not only does this suppress the warning, but it also more clearly indicate the intent that the call is not awaited.