Skip to content

[LSG] LoggerMessage source generator generates error when using template destructuring #69490

@gingters

Description

@gingters

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:

[LoggerMessage(2020, LogLevel.Trace, "Transporting {@Response}")]
partial void LogTransporting(object response);

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions