I am developing WebAPI and one of WebApi action methods calls another method that has Async method inside which I don't want to wait for. Just call and forget.
public async Task<IHttpActionResult> Convert(....)
{
//......
//VS warning here
_asyncJobService.SendWebHook();
//......
}
public async Task<HttpResponseMessage> SendWebHook()
{
//Send and forget, don't wait for result
return await httpClient.GetAsync("http://stackoverflow.com");
}
The warning which I get from VS is
Warning CS4014 Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
What would be the correct way to wire up everything without VS warnings?