Closed hakenr closed 3 years ago
StyleCop is suposed to ignore files with .g.cs
. @sharwell .
All generated code should have the following in a comment at the top of the file:
// <auto-generated/>
For compatibility with the legacy WinForms designer, StyleCop Analyzers 1.0 did not require files ending with .Designer.cs to include this comment. The same exception was not made for .g.cs because the XAML compiler did emit the expected comment.
Starting with StyleCop Analyzers 1.1, the designation of generated code was deferred to Roslyn itself. The Roslyn semantics for marking a file as generated when it fails to include the expected comment are implemented here:
GitHubThe Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs. - dotnet/roslyn
Got it, I'm using StyleCop Analyzers 1.0.x. But still the comment should be there... ;-)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
SYMPTOM Generated code violates StyleCop rule SA1517:CodeMustNotContainBlankLinesAtStartOfFile.
CAUSE The
#pragma warning disable
currently used is not enough. You should use// <auto-generated />
or other official generated code markers to prevent code-analysis of generated code.