From 6747e90b0501dd097f0252b6d44e4838bb915fe2 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 11 Mar 2019 10:31:37 -0700 Subject: [PATCH] Preserve diagnostics when rewriting Red nodes (dotnet/aspnetcore-tooling#319) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/276532454ec16b002be2c664dbf2f4f260f42a2a --- src/Razor/tools/RazorSyntaxGenerator/SourceWriter.cs | 3 +++ 1 file changed, 3 insertions(+) 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);");