Skip to content

Commit 9172917

Browse files
authored
Add <auto-generated/> tag so stylecop doesn't evaluate generated code.
1 parent 595ef75 commit 9172917

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/StringLiteralGenerator/Utf8StringLiteralGenerator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace StringLiteralGenerator
1212
[Generator]
1313
public class Utf8StringLiteralGenerator : ISourceGenerator
1414
{
15-
private const string attributeText = @"using System;
15+
private const string attributeText = @"// <auto-generated />
16+
using System;
1617
namespace StringLiteral
1718
{
1819
[System.Diagnostics.Conditional(""COMPILE_TIME_ONLY"")]
@@ -91,6 +92,7 @@ string generate(INamedTypeSymbol containingType, IEnumerable<(string methodName,
9192

9293
if (!string.IsNullOrEmpty(containingType.ContainingNamespace.Name))
9394
{
95+
buffer.AppendLine("// <auto-generated />");
9496
buffer.Append(@"namespace ");
9597
buffer.Append(containingType.ContainingNamespace.ToDisplayString());
9698
buffer.Append(@"

0 commit comments

Comments
 (0)