Mark logging source generator file as generated (#53275)
authorMartin Costello <martin@martincostello.com>
Tue, 15 Jun 2021 21:56:13 +0000 (22:56 +0100)
committerGitHub <noreply@github.com>
Tue, 15 Jun 2021 21:56:13 +0000 (16:56 -0500)
Give the output file for the M.E.Logging logging classes a ".g" suffix
so that it is treated as a generated file to prevent it being flagged by
source analyzers for violations the application developer cannot fix
for themselves.

src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.cs

index 73ca6a7..92105d5 100644 (file)
@@ -39,7 +39,7 @@ namespace Microsoft.Extensions.Logging.Generators
                 var e = new Emitter();
                 string result = e.Emit(logClasses, context.CancellationToken);
     
-                context.AddSource("LoggerMessage", SourceText.From(result, Encoding.UTF8));
+                context.AddSource("LoggerMessage.g.cs", SourceText.From(result, Encoding.UTF8));
             }
         }