Skip to content

LOGGEN031 Diagnostic breaks Serilog object serialization #5336

Closed

Description

@alexaka1

Description

Just simply including Microsoft.Extensions.Http.Resilience package in a project breaks source generated logging, because of LOGGEN031 reporting that

Error LOGGEN031 : Logging method "LogSomeMessage" has template(s) that start with "@": @SomeProperty (https://aka.ms/dotnet-extensions-warnings/LOGGEN031)

Reproduction Steps

https://github.com/alexaka1/repro-dotnet-extensions-LOGGEN031/blob/main/WebApplication1/Program.cs#L16

Expected behavior

The diagnostic does not error on use @ symbol in logger templates, since many logging frameworks use this to indicate serialization of the property is required.

Actual behavior

Cannot build project because of the error.

Regression?

Don't know.

Known Workarounds

Don't use the mentioned library.

Configuration

.NET SDK:
 Version:           8.0.303
 Commit:            29ab8e3268
 Workload version:  8.0.300-manifests.c915c39d
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.5
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.303/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.7
  Architecture: arm64
  Commit:       2aade6beb0

.NET SDKs installed:
  8.0.303 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/opt/homebrew/opt/dotnet/libexec]

global.json file:
  Not found

Other information

No response

Metadata

Metadata

Assignees

Labels

area-compliancebugwork in progress 🚧

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions