You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Logging source generation: the WarningLogMethod example reports SYSLIB1013, not SYSLIB0025 #57059
Under "Log method anatomy", the article says the WarningLogMethod example (Message = "M1 {Ex} {Ex2}") reports SYSLIB0025:
In the preceding example, the WarningLogMethod reports a DiagnosticSeverity.Warning of SYSLIB0025.
The warning it reports is SYSLIB1013. SYSLIB0025 is "SuppressIldasmAttribute is obsolete", an unrelated obsoletion warning. The message the article quotes below that sentence is SYSLIB1013's.
Repro with .NET SDK 10.0.404 and Microsoft.Extensions.Logging.Abstractions 10.0.15: the article's example in a file-based app, run with dotnet run Program.cs:
#:package Microsoft.Extensions.Logging.Abstractions@10.0.15usingMicrosoft.Extensions.Logging;Console.WriteLine("Built.");staticpartialclassLog{// The example from the "Compile-time logging source generation" article.// This causes a warning[LoggerMessage(EventId=0,Level=LogLevel.Debug,Message="M1 {Ex} {Ex2}")]publicstaticpartialvoidWarningLogMethod(ILoggerlogger,Exceptionex,Exceptionex2);}
Output:
Program.cs(14,19): warning SYSLIB1013: Don't include a template for ex in the logging message since it is implicitly taken care of (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1013)
Built.
Activity