The AutoGeneratedProgram class created for netcoreapp projects does not have a CompilerGenerated attribute
Steps to Repro
I created an xUnit test project in Visual Studio 2017 RC3(15.0.26206.0) that targets .NETCoreApp 1.1. Thereafter added a Roslyn-based code analyzer via NuGet, and it unexpectedly flagged several warnings in an auto-generated {ProjectName}.Program.cs file.
The content of the file is:
//
The AutoGeneratedProgram class should be marked with the CompilerGenerated attribute to follow established conventions that allow tools such as code analyzers to identify (and ignore) generated code.
Expected behavior
No warnings should be there.
Actual behavior
Observed warnings like 1>obj\Debug\netcoreapp1.1\XUnitTestProject1.Program.cs(2,58,2,65): warning CT3103: Types should have an access modifier specified. 1>obj\Debug\netcoreapp1.1\XUnitTestProject1.Program.cs(2,58,2,65): warning CT1000: Classes with all static members should be static. 1>obj\Debug\netcoreapp1.1\XUnitTestProject1.Program.cs(2,79,2,83): warning CT3104: Members should have an access modifier specified.
~~Is there a workaround available?~~
Edit: If anyone finds this issue and is looking for a fix to get rid of style cop errors. Update the xunit nuget package. This comment helped me.
Not reproable in VS2017.5 Version 15.5.0 Preview 4.0 [27109.1.d15rel] Created xUnit NetCore test project, & built it
Added "Microsoft.CodeAnalysis" to Xunit project, & then built it, no warnings.