Excluding a file from the roslyn analyzers -


since have lot of generated code, roslyn analyzers go crazy code. there way exclude files analyzers?

there no way explicitly "don't run analyzer on generated code". have handle manually.

i believe heuristics used follows. (i took list giovanni bassi, 1 of authors of code cracker) file auto generated if of following conditions met:

it has 1 of these attributes:

  • debuggernonusercodeattribute
  • generatedcodeattribute

the file path contains:

  • *.g.cs
  • *.designer.cs
  • *.assemblyinfo.cs
  • *.generated.cs
  • *.g.cs
  • *.g.i.cs
  • *.assemblyattributes.cs
  • temporarygeneratedfile_*.cs

a header comment contains:

  • <auto-generated>

the code cracker project has number of extension methods detecting generated files. check out generatedcodeanalysisextensions


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -