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

LoggerMessage - SYSLIB1008 should have a better message #52221

Closed
eerhardt opened this issue May 3, 2021 · 1 comment · Fixed by #52684
Closed

LoggerMessage - SYSLIB1008 should have a better message #52221

eerhardt opened this issue May 3, 2021 · 1 comment · Fixed by #52684

Comments

@eerhardt
Copy link
Member

eerhardt commented May 3, 2021

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label May 3, 2021
@ghost
Copy link

ghost commented May 3, 2021

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: eerhardt
Assignees: -
Labels:

area-Extensions-Logging

Milestone: -

@maryamariyan maryamariyan removed the untriaged New issue has not been triaged by the area owner label May 3, 2021
@maryamariyan maryamariyan added this to the 6.0.0 milestone May 3, 2021
@maryamariyan maryamariyan changed the title SYSLIB1008 should have a better message LoggerMessage - SYSLIB1008 should have a better message May 4, 2021
maryamariyan added a commit to maryamariyan/runtime that referenced this issue May 13, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 13, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 13, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 27, 2021
maryamariyan added a commit to maryamariyan/runtime that referenced this issue May 27, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 27, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants