Skip to content
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

LOGGEN031 Diagnostic breaks Serilog object serialization #5336

Closed
alexaka1 opened this issue Aug 3, 2024 · 0 comments · Fixed by #5370
Closed

LOGGEN031 Diagnostic breaks Serilog object serialization #5336

alexaka1 opened this issue Aug 3, 2024 · 0 comments · Fixed by #5370
Assignees
Labels
bug This issue describes a behavior which is not expected - a bug.

Comments

@alexaka1
Copy link

alexaka1 commented Aug 3, 2024

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants