Skip to content

LoggerMessage - SYSLIB1008 should have a better message #52221

@eerhardt

Description

@eerhardt

I made the mistake of adding static to my LoggerMessage method (through copy-paste mistake) and I wanted to use my instance ILogger _logger field, so I didn't have an ILogger in the method parameters.

I got this error message:

Severity Code	Description	Project	File	Line	Suppression State
Error	SYSLIB1008	One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface Microsoft.Extensions.Diagnostics.HealthChecks C:\git\aspnetcore\src\HealthChecks\HealthChecks\src\HealthCheckPublisherHostedService.cs    207

This message didn't help me right away because I didn't want to pass an ILogger in the arguments. So it took me a while to realize the method was static and that was the issue.

We should update this message to also include that the method is static.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions