In following code:
ILogger<LogTest> logger = app.Services.GetRequiredService<ILogger<LogTest>>();
logger.LogError($"Test{jobResult}");
The compiler give the following message:
CA2254 The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
That is normal and that ensure to be able to detect 2 (or more) similar consecutive message. That is a little new and described here: CA2254: Template should be a static expression.
How I can reproduce the same behavior for my own code, into own class?