I have this code
[HttpGet("average/{videoGuid}")]
public async Task<IActionResult> AverageRatingOfVideo([FromRoute] string videoGuid)
{
_logger.LogInformation($"Finding average rating of video : {videoGuid}");
var avg = await _ratingService.GetVideoRatingAverageAsync(videoGuid);
return Ok(avg);
}
and I'm getting a warning here $"Finding average rating of video : {videoGuid}"
Message template should be compile time constant
I'm using Rider, there is no suggestion to fix this warning.
I can't understand why this gives me a warning, how could I fix this ?
c#
– Varnado_logger.LogInformation("Finding average rating of video : {videoGuid}", videoGuid)
or_logger.LogInformation("Finding average rating of video : " + videoGuid)
. I would say that the reason for it is structured logging which uses the same curly brackets for templating and analyzer missing the interpolated string part. – Leghorn