Skip to content

Doesn't appear to work #33

Description

@ZzZombo

Description

I've just added this to my ASP.NET project targeting .NET 9. The SG only generates the two attributes and that's it. I added it using plain PackageReference w/ no other metadata on it but the version and package name in the project file. I've enabled saving compiler generated files to disk and there is no output other than the two files as per above. The only visible effect in my IDE, Rider, is that it stops suggesting to convert the calls to ILogger.Log*() methods to source generated versions using a code fix, so that's something at least, but the Dependencies tree view of the project doesn't show anything under the Source Generators node attributed to this package, but the two attributes, again.

The debugger simply walks through the GenericLoggerExtensions class' methods, so it doesn't seem the generator took effect. This is the call I specifically debugged: this.logger.LogInformation("Starting update check for all directories.");. So nothing fancy, just a string output. I don't see any reason such simple call wouldn't be supported by the package so there must be another reason it doesn't work.

Reproduction Steps

public class Foo {
	private readonly ILogger<Foo> logger; // init. in the constructor from a DI logger factory.

<...>

public void DoIt() {
	this.logger.LogInformation("Starting update check for all directories.");

<...>

Expected behavior

SG works.

Actual behavior

SG doesn't take place.

Regression?

Can't say.

Known Workarounds

None.

Configuration

  • .NET 9.0.17.
  • Can't say.

Other information

N/A.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions