Skip to content

CoreBindingHelper for configuration binding source generator should be marked as [GeneratedCode] #89007

Description

@martincostello

Description

When enabling the Configuration binding source generator improvements in an application which requires a minimum level of code coverage, code emitted by the generator counts towards the application's own coverage metrics.

If the code emitted for the CoreBindingHelper class was annotated with [GeneratedCode] then it would be easy to exclude from coverage metrics in the consuming application without having to know the internal implementation details (e.g. to exclude a class named Microsoft.Extensions.Configuration.Binder.SourceGeneration.CoreBindingHelper).

Reproduction Steps

Inspect the emitted code for an application using the configuration binding source generator in a tool such as ILSpy. The type is not annotated with [GeneratedCode].

Expected behavior

The types emitted by the source generator into the user's assembly as marked as [GeneratedCode] so they can be easily excluded.

Actual behavior

The generated types are not annotated as such.

Regression?

No.

Known Workarounds

Exclude the Microsoft.Extensions.Configuration.Binder.SourceGeneration.CoreBindingHelper type from code coverage metrics, such as using Exclude for coverlet.

Configuration

.NET SDK 8.0.100-preview.6.23330.14

Other information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions