Skip to content

Excluding generated code does not work #45810

@boppbo

Description

@boppbo

Type of issue

Missing information

Description

I refactored my code generator to emit .generated.cs instead of .g.cs trying to get rid of warnings. This did not change anything.
e.g. .generated.cs(11,30): Warning CS0169 : The field 'x' is never used.

As the runtime uses .g.cs it should be added or replace the .generated.cs entry in the list of valid patterns that are considered generated code (https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Emitter.cs)

Next I'm trying to use the GeneratedCodeAttribute as seen in the runtime file. This attribute isn't mentioned at all in docs.

Page URL

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#exclude-generated-code

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/configuration-options.md

Document Version Independent Id

36879d50-dcc5-3376-9404-d60379024c0e

Platform Id

c266a76b-4885-d54c-7bd4-4aeae078a508

Article author

@gewarren

Metadata

  • ID: fa74a3f7-feef-0ec8-aebe-48bd106523dc
  • PlatformId: c266a76b-4885-d54c-7bd4-4aeae078a508
  • Service: dotnet-fundamentals

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions