Skip to content

Logging Source Generator emits CS0757 errors when referencing Microsoft.Extensions.Http.Resilience with .NET 10 preview 4 builds #6297

@martincostello

Description

@martincostello

Description

I have a number of applications where for test purposes I've set them up to ingest changes from the .NET daily builds feed out of the dotnet/sdk repo.

For four of those applications, updating to .NET 10 preview 4 daily builds somewhere after version 10.0.100-preview.4.25208.36 of the .NET SDK is causing the application to fail to compile due to CS0757 errors for duplication partial logger method implementations. We use this pattern in many of the applications ingesting daily builds, but only these four applications are affected.

I'm not sure exactly why the errors occur, but in the case of this application, removing use of Microsoft.Extensions.Http.Resilience resolves the problem.

The errors look very similar to #4286 from .NET 8.

Maybe 10.0 previews of the extensions packages now need to start being published?

Reproduction Steps

  1. Clone martincostello/costellobot@2cac515
  2. Run build.ps1 in the root of the repository.

Expected behavior

The application builds successfully and the tests pass.

Actual behavior

Application fails to compile with many errors similar to:

Error: /home/runner/work/costellobot/costellobot/artifacts/obj/Costellobot/release/Microsoft.Extensions.Logging.Generators/Microsoft.Extensions.Logging.Generators.LoggerMessageGenerator/LoggerMessage.g.cs(159,40): error CS0757: A partial method may not have multiple implementing declarations [/home/runner/work/costellobot/costellobot/src/Costellobot/Costellobot.csproj]

Regression?

Since .NET 10 preview 3.

Known Workarounds

Remove usage of Microsoft.Extensions.Http.Resilience.

Configuration

Version 10.0.100-preview.4.25214.32 of the .NET SDK.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a behavior which is not expected - a bug.needs-area-label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions