Skip to content

Support nested logging classes in Logging Source Generator #52301

@eerhardt

Description

@eerhardt

A common logging pattern is to put all the logging related methods in a nested class of the service that needs to log. However, the Logging Source Generator doesn't support this. When I try to do it, I get an error saying:

Severity	Code	Description	Project	File	Line	Suppression State
Error	SYSLIB1004	Logging class cannot be in nested types	Microsoft.Extensions.Diagnostics.HealthChecks	C:\git\aspnetcore\src\HealthChecks\HealthChecks\src\DefaultHealthCheckService.cs	201	

We should support this common coding pattern in the Logging Source Generator.

See discussion at dotnet/aspnetcore#32414 (comment)

cc @maryamariyan @davidfowl @shirhatti

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions