-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
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