diff --git a/src/Razor/tools/RazorSyntaxGenerator/SourceWriter.cs b/src/Razor/tools/RazorSyntaxGenerator/SourceWriter.cs index 71081f14fe..5a9a7112bb 100644 --- a/src/Razor/tools/RazorSyntaxGenerator/SourceWriter.cs +++ b/src/Razor/tools/RazorSyntaxGenerator/SourceWriter.cs @@ -1364,6 +1364,9 @@ namespace RazorSyntaxGenerator Write(CamelCase(field.Name)); } WriteLine(");"); + WriteLine(" var diagnostics = GetDiagnostics();"); + WriteLine(" if (diagnostics != null && diagnostics.Length > 0)"); + WriteLine(" newNode = newNode.WithDiagnostics(diagnostics);"); WriteLine(" var annotations = GetAnnotations();"); WriteLine(" if (annotations != null && annotations.Length > 0)"); WriteLine(" return newNode.WithAnnotations(annotations);");