In my program, i'm making a request, and I log the request and the response.
But using the ConfigureAwait(false), may loses the context of my "logger" object, which is logging the request in one file, and the response in another file.
try
{
logger.VerboseRequest(tokenParameters.Endpoint, payloadJson, options);
serializedResponse = await httpHandler.PostAsync<string>
(tokenParameters.Endpoint, payloadJson, options, cts.Token)
.ConfigureAwait(false);
}
catch (TaskCanceledException)
{
throw new TokenTimeoutException();
}
catch (Exception ex)
{
logger.Error(String.Format("Error when posting to Endpoint: {0}",ex.Message));
throw;
}
Any Idea why this is happening? Or what to do to avoid it?
By removing the ConfigureAwait(false) I may have TimeOut problems, so that is not an option.