I'm trying to enable all possible warnings as error by default but CS8019 can't be enabled due to generated code that can't be ignored :( (My example is CS8019 but i'm sure that i'll find a few more as none of the compiler warnings seem to check for generated code)
It's can even be enabled as a warning as otherwise it flood the error list with non-actionable lines.
For example GenerateTargetFrameworkMonikerAttribute generated files trigger it :
C:\Users\jroncagl\AppData\Local\Temp\.NETFramework,Version=v4.5.1.AssemblyAttributes.cs(2,1)
: warning CS8019: Unnecessary using directive. [c:\Code\test.csproj]
But winforms *.Designer.cs or WPF *.g.cs files also generate it.
The warning is generated in CSharpCompilation.cs method ReportUnusedImports.
I would suggest that the compiler (And IDE as the analyzers also run here) exclude by default generated files (With a documentation of how this distinction is made) from all warning and errors that wouldn't fail the build (Coming from analyzers or from the compiler provided diagnostics).
This issue is related to a few others :
*.Designer.cs files it would mean that every .NET developer need to copy paste the same ignores in all projects.FixAllProvider patched this problem after the fact and created discrepenciesNote: IDE0005 is a little bit better as it seem to ignore WPF generated files due to <auto-generated> markers, but still doesn't ignore .NETFramework,Version=v4.5.1.AssemblyAttributes.cs or *.Designer.cs.
We will track the work for this in #3705. I will add a note to #3705 noting your feedback on the solutions proposed in that issue.
Is there any known workaround regarding that issue (with VS 2015 - Update2)?
This is a solid workaround: http://stackoverflow.com/a/35553079/1108891
This Workaround is only applicable to the AssemblyAttributes.cs file. It is not working for .g.cs files in general. So, still there is a need for ignoring These files.
Related to #24976 and thus still an issue?
Most helpful comment
Is there any known workaround regarding that issue (with VS 2015 - Update2)?