-
Notifications
You must be signed in to change notification settings - Fork 482
Open
dotnet/sdk
#50766Description
Analyzer
Diagnostic ID: CA1727 : Use PascalCase for named placeholders
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 6.0.301
Describe the bug
CA1727 is not reported for messages in LoggerMessageAttribute
Steps To Reproduce
- Make sure that CA1727 is enabled, e.g. by using
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
- Write a line like
logger.LogError("Unsuccessful status code {statusCode}");
- Notice that CA1727 is shown.
- Remove the line and write a partial method with LoggerMessageAttribute like
[LoggerMessage(-1, LogLevel.Error, "Unsuccessful status code {statusCode}")]
private partial void LogUnsuccessfulStatusCode(HttpStatusCode statusCode);
- Notice that the warning is not shown any more.
Expected behavior
CA1727 should be shown.
Actual behavior
CA1727 is not shown.
marhja, fredrikahs, lupusbytes and Meir017
Metadata
Metadata
Assignees
Labels
No labels