You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@boppbo The warning in your example, CS0169, doesn't come from code analysis - it comes from the C# compiler.
Yes, i learned that too and used #pragma directives to disable them. Thanks for trying to help.
Maybe it would be worth mentioning compiler warnings in this section as it was the article i found first and it would be nice to fall easier in the pit of success.
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
Related Issues
The text was updated successfully, but these errors were encountered: