Generated Program.cs should have a header similar to other auto generated files. This will allow static analysis tools to ignore this file.
// <auto-generated> This file has been auto generated. </auto-generated>
or:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated by the MSBuild WriteCodeFragment class.
Original issue:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2282
https://github.com/dotnet/roslyn/issues/16856
Requires a modification in logic here: https://github.com/Microsoft/vstest/blob/master/src/Microsoft.NET.Test.Sdk.targets#L42
@codito Happy to do a PR to fix this now that I know where the change needs to go.
@martincostello thanks a lot!