-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LSG] LoggerMessage source generator generates error when using template destructuring #69490
Comments
Tagging subscribers to this area: @dotnet/area-extensions-logging Issue DetailsDescriptionWhen using serilog object destructuring in a Reproduction StepsAdd this log message to a partial class:
Expected behaviorThe source generator should generate the logging method. Actual behaviorThe source generator creates an error: Regression?No response Known WorkaroundsNone. Using @ before the parameter name (as you would to escape reserved words) does not help. Configuration.NET 6.0.300 Other informationNo response
|
Looking |
fyi, as part of the bugfix in #60968 we fixed the sample case below: [LoggerMessage(EventId = 2020, Level = LogLevel.Trace, Message = "Transporting {Response}")]
public static partial void LogTransporting(ILogger logger, string @response); Where at sign goes over the method variable not the message template argument. |
This should be already fixed by #79038 |
Description
When using serilog object destructuring in a
LoggerMessage
template, the source generator won't recognize the parameter.Reproduction Steps
Add this log message to a partial class:
Expected behavior
The source generator should generate the logging method.
Actual behavior
The source generator creates an error:
[SYSLIB1014] Template '@Response' is not provided as argument to the logging method
Regression?
No response
Known Workarounds
None. Using @ before the parameter name (as you would to escape reserved words) does not help.
Configuration
.NET 6.0.300
Other information
No response
The text was updated successfully, but these errors were encountered: