Skip to content

Data redaction doesn't work with record class #5188

@IvoryFeng

Description

@IvoryFeng

If I use a class, it has no issue. But if I change class to record, I'll get errors. See below.

Step 1: add a record class
internal record User()
{
public int Id { get; set; }

    [NoDataClassification]
    public string? Email { get; set; }
}

Step 2: add log method
internal static partial class Logging
{
[LoggerMessage(6001, LogLevel.Information, "Logging User: {User}")]
public static partial void LogUser(this ILogger logger, [LogProperties] User user);
}

Errors:
image

Environment/configuration:

net8.0 enable enable

Metadata

Metadata

Assignees

Labels

area-telemetrybugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions