From 43824a4c1270dc24ae4dc28387e87008dbb6fef6 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 22 Apr 2019 14:43:13 -0700 Subject: [PATCH] Verify line pragmas on generated code (dotnet/aspnetcore-tooling#392) * Verify line pragmas on generated code \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/ca33b2d51be1b83f34f7de3fe6d4f6793c342633 --- .../CodeGenerationIntegrationTest.cs | 45 +++++++++++++ .../BasicComponent_DesignTime.codegen.cs | 4 +- .../BasicComponent_DesignTime.mappings.txt | 6 +- .../BasicComponent_Runtime.codegen.cs | 20 +++++- .../CodeGeneration/CodeRenderingContext.cs | 5 +- .../CodeGeneration/CodeWriterExtensions.cs | 25 ++++++-- .../DefaultCodeRenderingContext.cs | 11 +++- .../CodeGeneration/DefaultDocumentWriter.cs | 4 +- .../src/CodeGeneration/LinePragma.cs | 63 ++++++++++++++++++ .../ComponentDesignTimeNodeWriter.cs | 54 +++------------- .../Components/ComponentRuntimeNodeWriter.cs | 60 +++++++++++++---- .../src/DefaultRazorCSharpDocument.cs | 8 ++- .../src/RazorCSharpDocument.cs | 10 ++- .../CodeGenerationIntegrationTest.cs | 2 + .../ExtensibleDirectiveTest.cs | 1 + .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../Regression_784/TestComponent.codegen.cs | 14 +++- .../Regression_784/TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 30 ++++++++- .../TestComponent.codegen.cs | 8 ++- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 8 ++- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 30 ++++++++- .../TestComponent.codegen.cs | 38 ++++++++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 30 ++++++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 28 +++++++- .../ComponentImports/_Imports.codegen.cs | 26 +++++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 18 +++++- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 16 ++++- .../TestComponent.codegen.cs | 16 ++++- .../TestComponent.codegen.cs | 8 ++- .../TestComponent.codegen.cs | 16 ++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 26 +++++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 8 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 30 ++++++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 20 +++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 29 ++++++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 29 ++++++++- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 19 +++++- .../TestComponent.mappings.txt | 2 +- .../Regression_597/TestComponent.codegen.cs | 10 ++- .../Regression_597/TestComponent.mappings.txt | 2 +- .../Regression_609/TestComponent.codegen.cs | 20 +++++- .../Regression_609/TestComponent.mappings.txt | 2 +- .../Regression_784/TestComponent.codegen.cs | 20 +++++- .../Regression_784/TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.codegen.cs | 10 ++- .../TestComponent.mappings.txt | 2 +- .../IntegrationTests/IntegrationTestBase.cs | 64 +++++++++++++++++++ .../RazorBaselineIntegrationTestBase.cs | 61 ++++++++++++++++++ .../SourceMappingsSerializer.cs | 1 - 237 files changed, 1973 insertions(+), 368 deletions(-) create mode 100644 src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 05d14e1184..3f22db3670 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -42,6 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); var diagnostics = compiled.Compilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning); Assert.Equal("The using directive for 'System' appeared previously in this namespace", Assert.Single(diagnostics).GetMessage()); @@ -59,6 +60,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; Assert.Equal("RZ1014", Assert.Single(diagnotics).Id); @@ -82,6 +84,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); // We expect this test to generate a bunch of errors. Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); @@ -116,6 +119,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -148,6 +152,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -162,6 +167,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; Assert.Equal("RZ1016", Assert.Single(diagnotics).Id); @@ -179,6 +185,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -193,6 +200,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -216,6 +224,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -230,6 +239,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -251,6 +261,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -281,6 +292,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -312,6 +324,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -327,6 +340,7 @@ public class MyService AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -350,6 +364,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -371,6 +386,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -385,6 +401,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -406,6 +423,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -420,6 +438,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -434,6 +453,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -464,6 +484,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); } [Fact] @@ -478,6 +499,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: false); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; Assert.Equal("RZ3906", Assert.Single(diagnotics).Id); @@ -498,6 +520,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); var diagnostics = compiled.Compilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning); @@ -516,6 +539,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; @@ -540,6 +564,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. @@ -575,6 +600,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -609,6 +635,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -624,6 +651,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; @@ -642,6 +670,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -657,6 +686,7 @@ public class MyModel // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -681,6 +711,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -696,6 +727,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -718,6 +750,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -749,6 +782,7 @@ public class MyApp // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -781,6 +815,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -796,6 +831,7 @@ public class MyService // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -817,6 +853,7 @@ public class ThisShouldBeGenerated // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; @@ -844,6 +881,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -866,6 +904,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -881,6 +920,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -903,6 +943,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -918,6 +959,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -933,6 +975,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -964,6 +1007,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); } @@ -979,6 +1023,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName} // Assert AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertLinePragmas(compiled.CodeDocument, designTime: true); AssertSourceMappingsMatchBaseline(compiled.CodeDocument); var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.cs index 054b128eb5..fc6dd7e603 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.cs @@ -30,13 +30,15 @@ IDisposable __typeHelper = default(IDisposable); #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { + __o = #nullable restore #line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" - __o = this.ToString(); + this.ToString() #line default #line hidden #nullable disable + ; #nullable restore #line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" __o = string.Format("{0}", "Hello"); diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.mappings.txt index aff2ce3f1b..c505557cd3 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.mappings.txt @@ -5,19 +5,19 @@ Generated Location: (641:17,0 [11] ) Source Location: (38:1,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) |this.ToString()| -Generated Location: (1231:34,13 [15] ) +Generated Location: (1251:35,13 [15] ) |this.ToString()| Source Location: (79:3,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) |string.Format("{0}", "Hello")| -Generated Location: (1414:41,6 [29] ) +Generated Location: (1448:43,6 [29] ) |string.Format("{0}", "Hello")| Source Location: (132:6,12 [37] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) | void IDisposable.Dispose(){ } | -Generated Location: (1666:50,12 [37] ) +Generated Location: (1700:52,12 [37] ) | void IDisposable.Dispose(){ } | diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs index 5165db1451..8408389b50 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs @@ -15,9 +15,25 @@ namespace __GeneratedComponent protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "div"); - builder.AddAttribute(1, "class", this.ToString()); + builder.AddAttribute(1, "class", +#nullable restore +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" + this.ToString() + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(2, "\r\n Hello world\r\n "); - builder.AddContent(3, string.Format("{0}", "Hello")); + builder.AddContent(3, +#nullable restore +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" + string.Format("{0}", "Hello") + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(4, "\r\n"); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs index f726e2ad4b..d144558bb0 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -40,5 +39,9 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration public abstract void RenderChildren(IntermediateNode node); public abstract void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer); + + public virtual void AddLinePragma(LinePragma linePragma) + { + } } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs index 4f9c78d526..a97b2f02c7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs @@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration return NullDisposable.Default; } - return new LinePragmaWriter(writer, span.Value, context.Options); + return new LinePragmaWriter(writer, span.Value, context); } private static void WriteVerbatimStringLiteral(CodeWriter writer, string literal) @@ -596,13 +596,16 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration private class LinePragmaWriter : IDisposable { private readonly CodeWriter _writer; - private readonly RazorCodeGenerationOptions _codeGenerationOptions; + private readonly CodeRenderingContext _context; private readonly int _startIndent; + private readonly int _sourceLineIndex; + private readonly int _startLineIndex; + private readonly string _sourceFilePath; public LinePragmaWriter( CodeWriter writer, SourceSpan span, - RazorCodeGenerationOptions codeGenerationOptions) + CodeRenderingContext context) { if (writer == null) { @@ -610,11 +613,13 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration } _writer = writer; - _codeGenerationOptions = codeGenerationOptions; + _context = context; _startIndent = _writer.CurrentIndent; + _sourceFilePath = span.FilePath; + _sourceLineIndex = span.LineIndex; _writer.CurrentIndent = 0; - if (!_codeGenerationOptions.SuppressNullabilityEnforcement) + if (!_context.Options.SuppressNullabilityEnforcement) { var endsWithNewline = _writer.Length > 0 && _writer[_writer.Length - 1] == '\n'; if (!endsWithNewline) @@ -625,6 +630,9 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration } WriteLineNumberDirective(writer, span); + + // Capture the line index after writing the #line directive. + _startLineIndex = writer.Location.LineIndex; } public void Dispose() @@ -642,16 +650,21 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration _writer.WriteLine(); } + var lineCount = _writer.Location.LineIndex - _startLineIndex; + var linePragma = new LinePragma(_sourceLineIndex, lineCount, _sourceFilePath); + _context.AddLinePragma(linePragma); + _writer .WriteLine("#line default") .WriteLine("#line hidden"); - if (!_codeGenerationOptions.SuppressNullabilityEnforcement) + if (!_context.Options.SuppressNullabilityEnforcement) { _writer.WriteLine("#nullable disable"); } _writer.CurrentIndent = _startIndent; + } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs index 848d344c3e..afb717391a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs @@ -1,5 +1,4 @@ - -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -56,6 +55,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration Diagnostics = new RazorDiagnosticCollection(); Items = new ItemCollection(); SourceMappings = new List(); + LinePragmas = new List(); var diagnostics = _documentNode.GetAllDiagnostics(); for (var i = 0; i < diagnostics.Count; i++) @@ -94,6 +94,8 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration public List SourceMappings { get; } + internal List LinePragmas { get; } + public override IntermediateNodeWriter NodeWriter => Current.Writer; public override RazorCodeGenerationOptions Options { get; } @@ -200,6 +202,11 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration _scopes.RemoveAt(_scopes.Count - 1); } + public override void AddLinePragma(LinePragma linePragma) + { + LinePragmas.Add(linePragma); + } + private struct ScopeInternal { public ScopeInternal(IntermediateNodeWriter writer) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs index 8a6865f7ed..d6fb6742da 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using System.Security.Cryptography; -using System.Text; using Microsoft.AspNetCore.Razor.Language.Intermediate; namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration @@ -47,7 +46,8 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration cSharp, _options, context.Diagnostics.ToArray(), - context.SourceMappings.ToArray()); + context.SourceMappings.ToArray(), + context.LinePragmas.ToArray()); } private class Visitor : IntermediateNodeVisitor diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs new file mode 100644 index 0000000000..70ce098758 --- /dev/null +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs @@ -0,0 +1,63 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Globalization; +using Microsoft.Extensions.Internal; + +namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration +{ + public readonly struct LinePragma : IEquatable + { + public LinePragma(int startLineIndex, int lineCount, string filePath) + { + if (startLineIndex < 0) + { + throw new ArgumentOutOfRangeException(nameof(startLineIndex)); + } + + if (lineCount < 0) + { + throw new ArgumentOutOfRangeException(nameof(lineCount)); + } + + StartLineIndex = startLineIndex; + LineCount = lineCount; + FilePath = filePath; + } + + public int StartLineIndex { get; } + + public int EndLineIndex => StartLineIndex + LineCount; + + public int LineCount { get; } + + public string FilePath { get; } + + public override bool Equals(object obj) + { + return obj is LinePragma other ? Equals(other) : false; + } + + public bool Equals(LinePragma other) + { + return StartLineIndex == other.StartLineIndex && + LineCount == other.LineCount && + string.Equals(FilePath, other.FilePath, StringComparison.Ordinal); + } + + public override int GetHashCode() + { + var hash = HashCodeCombiner.Start(); + hash.Add(StartLineIndex); + hash.Add(LineCount); + hash.Add(FilePath); + return hash; + } + + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "Line index {0}, Count {1} - {2}", StartLineIndex, LineCount, FilePath); + } + } +} diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDesignTimeNodeWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDesignTimeNodeWriter.cs index 648c958d8f..f18235f463 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDesignTimeNodeWriter.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDesignTimeNodeWriter.cs @@ -244,54 +244,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Components return; } - var firstChild = node.Children[0]; - if (firstChild.Source != null) + context.CodeWriter.WriteStartAssignment(DesignTimeVariable); + for (var i = 0; i < node.Children.Count; i++) { - using (context.CodeWriter.BuildLinePragma(firstChild.Source.Value, context)) + if (node.Children[i] is IntermediateToken token && token.IsCSharp) { - var offset = DesignTimeVariable.Length + " = ".Length; - context.CodeWriter.WritePadding(offset, firstChild.Source, context); - context.CodeWriter.WriteStartAssignment(DesignTimeVariable); - - for (var i = 0; i < node.Children.Count; i++) - { - if (node.Children[i] is IntermediateToken token && token.IsCSharp) - { - context.AddSourceMappingFor(token); - context.CodeWriter.Write(token.Content); - } - else - { - // There may be something else inside the expression like a Template or another extension node. - context.RenderNode(node.Children[i]); - } - } - - context.CodeWriter.WriteLine(";"); + WriteCSharpToken(context, token); + } + else + { + // There may be something else inside the expression like a Template or another extension node. + context.RenderNode(node.Children[i]); } } - else - { - context.CodeWriter.WriteStartAssignment(DesignTimeVariable); - for (var i = 0; i < node.Children.Count; i++) - { - if (node.Children[i] is IntermediateToken token && token.IsCSharp) - { - if (token.Source != null) - { - context.AddSourceMappingFor(token); - } - - context.CodeWriter.Write(token.Content); - } - else - { - // There may be something else inside the expression like a Template or another extension node. - context.RenderNode(node.Children[i]); - } - } - context.CodeWriter.WriteLine(";"); - } + context.CodeWriter.WriteLine(";"); } public override void WriteHtmlContent(CodeRenderingContext context, HtmlContentIntermediateNode node) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs index 72e18f24cc..83d1c2941f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs @@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components { if (node.Children[i] is IntermediateToken token && token.IsCSharp) { - context.CodeWriter.Write(token.Content); + WriteCSharpToken(context, token); } else { @@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components Debug.Assert(_currentAttributeValues.Count == 0); context.RenderChildren(node); - WriteAttribute(context.CodeWriter, node.AttributeName, _currentAttributeValues); + WriteAttribute(context, node.AttributeName, _currentAttributeValues); _currentAttributeValues.Clear(); } @@ -282,7 +282,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Components throw new ArgumentNullException(nameof(node)); } - context.CodeWriter.WriteUsing(node.Content, endLine: true); + if (node.Source.HasValue) + { + using (context.CodeWriter.BuildLinePragma(node.Source.Value, context)) + { + context.CodeWriter.WriteUsing(node.Content); + } + } + else + { + context.CodeWriter.WriteUsing(node.Content, endLine: true); + } } public override void WriteComponent(CodeRenderingContext context, ComponentIntermediateNode node) @@ -481,7 +491,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components for (var i = 0; i < tokens.Count; i++) { - context.CodeWriter.Write(tokens[i].Content); + WriteCSharpToken(context, tokens[i]); } if (canTypeCheck) @@ -520,7 +530,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components for (var i = 0; i < tokens.Count; i++) { - context.CodeWriter.Write(tokens[i].Content); + WriteCSharpToken(context, tokens[i]); } context.CodeWriter.Write(")"); @@ -543,7 +553,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components for (var i = 0; i < tokens.Count; i++) { - context.CodeWriter.Write(tokens[i].Content); + WriteCSharpToken(context, tokens[i]); } if (canTypeCheck && NeedsTypeCheck(node)) @@ -690,11 +700,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Components } } - private void WriteAttribute(CodeWriter codeWriter, string key, IList value) + private void WriteAttribute(CodeRenderingContext context, string key, IList value) { - BeginWriteAttribute(codeWriter, key); - WriteAttributeValue(codeWriter, value); - codeWriter.WriteEndMethodInvocation(); + BeginWriteAttribute(context.CodeWriter, key); + WriteAttributeValue(context, value); + context.CodeWriter.WriteEndMethodInvocation(); } protected override void BeginWriteAttribute(CodeWriter codeWriter, string key) @@ -726,13 +736,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Components // Only the mixed case is complicated, we want to turn it into code that will concatenate // the values into a string at runtime. - private static void WriteAttributeValue(CodeWriter writer, IList tokens) + private static void WriteAttributeValue(CodeRenderingContext context, IList tokens) { if (tokens == null) { throw new ArgumentNullException(nameof(tokens)); } + var writer = context.CodeWriter; var hasHtml = false; var hasCSharp = false; for (var i = 0; i < tokens.Count; i++) @@ -770,7 +781,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components insideCSharp = true; } - writer.Write(token.Content); + WriteCSharpToken(context, token); } else { @@ -796,7 +807,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Components } else if (hasCSharp) { - writer.Write(string.Join("", tokens.Select(t => t.Content))); + foreach (var token in tokens) + { + WriteCSharpToken(context, token); + } } else if (hasHtml) { @@ -808,5 +822,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Components writer.Write("true"); } } + + private static void WriteCSharpToken(CodeRenderingContext context, IntermediateToken token) + { + if (string.IsNullOrWhiteSpace(token.Content)) + { + return; + } + + if (token.Source?.FilePath == null) + { + context.CodeWriter.Write(token.Content); + return; + } + + using (context.CodeWriter.BuildLinePragma(token.Source, context)) + { + context.CodeWriter.WritePadding(0, token.Source.Value, context); + context.CodeWriter.Write(token.Content); + } + } } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs index cae8cfb69d..4cc1711985 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Language.CodeGeneration; namespace Microsoft.AspNetCore.Razor.Language { @@ -11,13 +12,15 @@ namespace Microsoft.AspNetCore.Razor.Language private readonly string _generatedCode; private readonly RazorDiagnostic[] _diagnostics; private readonly SourceMapping[] _sourceMappings; + private readonly LinePragma[] _linePragmas; private readonly RazorCodeGenerationOptions _options; public DefaultRazorCSharpDocument( string generatedCode, RazorCodeGenerationOptions options, RazorDiagnostic[] diagnostics, - SourceMapping[] sourceMappings) + SourceMapping[] sourceMappings, + LinePragma[] linePragmas) { if (generatedCode == null) { @@ -34,6 +37,7 @@ namespace Microsoft.AspNetCore.Razor.Language _diagnostics = diagnostics ?? Array.Empty(); _sourceMappings = sourceMappings ?? Array.Empty(); + _linePragmas = linePragmas ?? Array.Empty(); } public override IReadOnlyList Diagnostics => _diagnostics; @@ -42,6 +46,8 @@ namespace Microsoft.AspNetCore.Razor.Language public override IReadOnlyList SourceMappings => _sourceMappings; + internal override IReadOnlyList LinePragmas => _linePragmas; + public override RazorCodeGenerationOptions Options => _options; } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs index bfaa53b719..d7ff5fb66c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.CodeGeneration; namespace Microsoft.AspNetCore.Razor.Language { @@ -17,6 +18,8 @@ namespace Microsoft.AspNetCore.Razor.Language public abstract RazorCodeGenerationOptions Options { get; } + internal virtual IReadOnlyList LinePragmas { get; } + public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) { if (generatedCode == null) @@ -34,14 +37,15 @@ namespace Microsoft.AspNetCore.Razor.Language throw new ArgumentNullException(nameof(diagnostics)); } - return new DefaultRazorCSharpDocument(generatedCode, options, diagnostics.ToArray(), sourceMappings: null); + return new DefaultRazorCSharpDocument(generatedCode, options, diagnostics.ToArray(), sourceMappings: null, linePragmas: null); } public static RazorCSharpDocument Create( string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics, - IEnumerable sourceMappings) + IEnumerable sourceMappings, + IEnumerable linePragmas) { if (generatedCode == null) { @@ -63,7 +67,7 @@ namespace Microsoft.AspNetCore.Razor.Language throw new ArgumentNullException(nameof(sourceMappings)); } - return new DefaultRazorCSharpDocument(generatedCode, options, diagnostics.ToArray(), sourceMappings.ToArray()); + return new DefaultRazorCSharpDocument(generatedCode, options, diagnostics.ToArray(), sourceMappings.ToArray(), linePragmas.ToArray()); } } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 5faa8cfbbc..578a52740f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -979,6 +979,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); AssertSourceMappingsMatchBaseline(codeDocument); + AssertLinePragmas(codeDocument, designTime: true); } private void RunTimeTest() @@ -1002,6 +1003,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests // Assert AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); + AssertLinePragmas(codeDocument, designTime: false); } private void RunRuntimeTagHelpersTest(IEnumerable descriptors) diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ExtensibleDirectiveTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ExtensibleDirectiveTest.cs index 11bfe9793e..924d143593 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ExtensibleDirectiveTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ExtensibleDirectiveTest.cs @@ -32,6 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests // Assert AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); + AssertLinePragmas(codeDocument, designTime: true); AssertSourceMappingsMatchBaseline(codeDocument); } } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs index 7b9e5c6721..af8a3beb9d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs @@ -26,7 +26,15 @@ using System.Threading.Tasks; #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async (e) => await Task.Delay(10)); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + async (e) => await Task.Delay(10) + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.mappings.txt index da693d568e..c5f558697a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (285:11,0 [28] ) Source Location: (49:1,18 [33] x:\dir\subdir\Test\TestComponent.cshtml) |async (e) => await Task.Delay(10)| -Generated Location: (1024:28,135 [33] ) +Generated Location: (1114:31,18 [33] ) |async (e) => await Task.Delay(10)| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs index 890869b955..c09bfd39b5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs @@ -26,7 +26,15 @@ using System.Threading.Tasks; #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt index 3535131bb7..17c648438c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Generated Location: (285:11,0 [28] ) Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (1024:28,135 [7] ) +Generated Location: (1113:31,17 [7] ) |OnClick| Source Location: (73:2,12 [91] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (73:2,12 [91] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1166:33,12 [91] ) +Generated Location: (1319:41,12 [91] ) | Task OnClick(UIMouseEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs index 4fd3f9c3fa..689daabc69 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs @@ -26,7 +26,15 @@ using System.Threading.Tasks; #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async () => await Task.Delay(10)); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + async () => await Task.Delay(10) + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.mappings.txt index 5e145c5d5f..8fb2db7b1e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (285:11,0 [28] ) Source Location: (49:1,18 [32] x:\dir\subdir\Test\TestComponent.cshtml) |async () => await Task.Delay(10)| -Generated Location: (1024:28,135 [32] ) +Generated Location: (1114:31,18 [32] ) |async () => await Task.Delay(10)| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs index 473b76e707..dd3bd717fa 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs @@ -26,7 +26,15 @@ using System.Threading.Tasks; #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt index 77307d3ca3..7853aada67 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Generated Location: (285:11,0 [28] ) Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (1024:28,135 [7] ) +Generated Location: (1113:31,17 [7] ) |OnClick| Source Location: (73:2,12 [73] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (73:2,12 [73] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1166:33,12 [73] ) +Generated Location: (1319:41,12 [73] ) | Task OnClick() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs index df36edafe1..f86a75020b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, "MM/dd"); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , "MM/dd"); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd"); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt index eb70c72849..f02cd47db4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml) |CurrentDate| -Generated Location: (844:22,71 [11] ) +Generated Location: (957:25,41 [11] ) |CurrentDate| Source Location: (91:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | -Generated Location: (1148:28,12 [77] ) +Generated Location: (1325:36,12 [77] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs index 60dd84f6d5..a63340e070 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt index 66994d5d83..c36485f06d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (957:25,41 [11] ) |ParentValue| Source Location: (70:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1130:28,12 [50] ) +Generated Location: (1307:36,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs index 5095e79d77..e2ba6b0dd2 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt index 51928f7675..1ffd60a4b9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (934:25,18 [11] ) |ParentValue| Source Location: (47:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1130:28,12 [55] ) +Generated Location: (1284:36,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs index 5095e79d77..fa52a6bb97 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt index 4f1af18790..c27f26a64c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (933:25,17 [11] ) |ParentValue| Source Location: (46:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1130:28,12 [55] ) +Generated Location: (1283:36,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs index 5095e79d77..487a8fa05f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt index 19e08b3d2d..0852258114 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (12:0,12 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (928:25,12 [11] ) |ParentValue| Source Location: (41:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1130:28,12 [55] ) +Generated Location: (1278:36,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs index f9c07d662b..777e227cb5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(Enabled); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Enabled + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Enabled = __value, Enabled); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt index 15c93e7528..f3d6dd43fd 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (30:0,30 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Enabled| -Generated Location: (844:22,71 [7] ) +Generated Location: (946:25,30 [7] ) |Enabled| Source Location: (55:1,12 [41] x:\dir\subdir\Test\TestComponent.cshtml) | public bool Enabled { get; set; } | -Generated Location: (1118:28,12 [41] ) +Generated Location: (1284:36,12 [41] ) | public bool Enabled { get; set; } | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs index f1722b8765..bd6cd48d7a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,23 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, Format); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Format + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, Format); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt index 729d6d806a..e5a86aed7c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt @@ -1,11 +1,11 @@ Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) |CurrentDate| -Generated Location: (844:22,71 [11] ) +Generated Location: (942:25,26 [11] ) |CurrentDate| Source Location: (54:0,54 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Format| -Generated Location: (857:22,84 [6] ) +Generated Location: (1145:33,54 [6] ) |Format| Source Location: (77:1,12 [135] x:\dir\subdir\Test\TestComponent.cshtml) @@ -14,7 +14,7 @@ Source Location: (77:1,12 [135] x:\dir\subdir\Test\TestComponent.cshtml) public string Format { get; set; } = "MM/dd/yyyy"; | -Generated Location: (1146:28,12 [135] ) +Generated Location: (1498:44,12 [135] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs index 2cdf9884f5..ce862e532c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, "MM/dd/yyyy"); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , "MM/dd/yyyy"); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd/yyyy"); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt index 9680d2d7a7..43285d3976 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) |CurrentDate| -Generated Location: (844:22,71 [11] ) +Generated Location: (942:25,26 [11] ) |CurrentDate| Source Location: (80:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | -Generated Location: (1158:28,12 [77] ) +Generated Location: (1320:36,12 [77] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs index 60dd84f6d5..189e7a5983 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt index cf11197010..e76707e015 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (942:25,26 [11] ) |ParentValue| Source Location: (55:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1130:28,12 [50] ) +Generated Location: (1292:36,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs index 60dd84f6d5..aed8c9f08f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue); + __o = Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt index 5eb80dd1e9..8342633c6b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (14:0,14 [11] x:\dir\subdir\Test\TestComponent.cshtml) |ParentValue| -Generated Location: (844:22,71 [11] ) +Generated Location: (930:25,14 [11] ) |ParentValue| Source Location: (43:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1130:28,12 [50] ) +Generated Location: (1280:36,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs index 715cd2f13e..f8fd53f14b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs @@ -28,13 +28,15 @@ namespace Test #line default #line hidden #nullable disable + __o = #nullable restore #line 4 "x:\dir\subdir\Test\TestComponent.cshtml" - __o = myValue; + myValue #line default #line hidden #nullable disable + ; } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.mappings.txt index ab5eba52f4..637d4a38e4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.mappings.txt @@ -9,6 +9,6 @@ Generated Location: (845:24,2 [40] ) Source Location: (88:3,43 [7] x:\dir\subdir\Test\TestComponent.cshtml) |myValue| -Generated Location: (1048:32,43 [7] ) +Generated Location: (1068:33,43 [7] ) |myValue| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs index ca247e7bc4..c95ffb4142 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs @@ -28,13 +28,15 @@ namespace Test #line default #line hidden #nullable disable + __o = #nullable restore #line 4 "x:\dir\subdir\Test\TestComponent.cshtml" - __o = myValue; + myValue #line default #line hidden #nullable disable + ; } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.mappings.txt index dada0e5529..cf57a5d9eb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.mappings.txt @@ -9,6 +9,6 @@ Generated Location: (845:24,2 [40] ) Source Location: (87:3,42 [7] x:\dir\subdir\Test\TestComponent.cshtml) |myValue| -Generated Location: (1047:32,42 [7] ) +Generated Location: (1067:33,42 [7] ) |myValue| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs index 69dac0b202..53f7322056 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt index 545980e391..13cf599f32 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (908:22,135 [7] ) +Generated Location: (997:25,17 [7] ) |OnClick| Source Location: (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIEventArgs e) { } | -Generated Location: (1050:27,12 [44] ) +Generated Location: (1203:35,12 [44] ) | void OnClick(UIEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs index 75c0eb6e2b..0e120d6271 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt index 019a41ad20..ba63e4cc8f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (908:22,135 [7] ) +Generated Location: (997:25,17 [7] ) |OnClick| Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIMouseEventArgs e) { } | -Generated Location: (1050:27,12 [49] ) +Generated Location: (1203:35,12 [49] ) | void OnClick(UIMouseEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs index 91aec6e9db..a860a8013b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, x => { }); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + x => { } + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt index e65b926d36..191c479233 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) |x => { }| -Generated Location: (908:22,135 [8] ) +Generated Location: (998:25,18 [8] ) |x => { }| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs index 75c0eb6e2b..0e120d6271 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt index 019a41ad20..ba63e4cc8f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (908:22,135 [7] ) +Generated Location: (997:25,17 [7] ) |OnClick| Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIMouseEventArgs e) { } | -Generated Location: (1050:27,12 [49] ) +Generated Location: (1203:35,12 [49] ) | void OnClick(UIMouseEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs index 91aec6e9db..a860a8013b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, x => { }); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + x => { } + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.mappings.txt index e65b926d36..191c479233 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) |x => { }| -Generated Location: (908:22,135 [8] ) +Generated Location: (998:25,18 [8] ) |x => { }| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs index c01dd00171..f64be0176a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt index 91c03be2a7..18396d822c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (908:22,135 [7] ) +Generated Location: (997:25,17 [7] ) |OnClick| Source Location: (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick() { } | -Generated Location: (1050:27,12 [31] ) +Generated Location: (1203:35,12 [31] ) | void OnClick() { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs index 9a8663b4bb..76b2b1ee64 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs @@ -20,7 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, () => { }); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + () => { } + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt index 9e25017259..fe2bf2e2e6 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml) |() => { }| -Generated Location: (908:22,135 [9] ) +Generated Location: (998:25,18 [9] ) |() => { }| diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs index 0a0d9c71c9..e669a8073c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs @@ -20,14 +20,24 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnComponentHover); + __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" - __o = ParentBgColor; + OnComponentHover #line default #line hidden #nullable disable + ); + __o = +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentBgColor + +#line default +#line hidden +#nullable disable + ; } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt index 6573f9eaef..1eba11a4c9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt @@ -1,11 +1,11 @@ Source Location: (17:0,17 [16] x:\dir\subdir\Test\TestComponent.cshtml) |OnComponentHover| -Generated Location: (908:22,135 [16] ) +Generated Location: (997:25,17 [16] ) |OnComponentHover| Source Location: (55:0,55 [13] x:\dir\subdir\Test\TestComponent.cshtml) |ParentBgColor| -Generated Location: (1053:25,55 [13] ) +Generated Location: (1226:34,55 [13] ) |ParentBgColor| Source Location: (87:1,12 [132] x:\dir\subdir\Test\TestComponent.cshtml) @@ -16,7 +16,7 @@ Source Location: (87:1,12 [132] x:\dir\subdir\Test\TestComponent.cshtml) { } | -Generated Location: (1250:34,12 [132] ) +Generated Location: (1437:44,12 [132] ) | public string ParentBgColor { get; set; } = "#FFFFFF"; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs index f93e9a9e3f..231e828075 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs @@ -20,13 +20,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { + __o = #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" - __o = Foo; + Foo #line default #line hidden #nullable disable + ; } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt index c225072901..f1deeb8e82 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt @@ -1,13 +1,13 @@ Source Location: (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) |Foo| -Generated Location: (855:24,12 [3] ) +Generated Location: (875:25,12 [3] ) |Foo| Source Location: (36:1,16 [29] x:\dir\subdir\Test\TestComponent.cshtml) | int Foo = 18; | -Generated Location: (1046:33,16 [29] ) +Generated Location: (1080:35,16 [29] ) | int Foo = 18; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs index cdfa2835eb..ec7f72b1ba 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.codegen.cs @@ -7,14 +7,28 @@ namespace Test using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Components; - using System.Threading.Tasks; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using System.Threading.Tasks; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async (e) => await Task.Delay(10))); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + async (e) => await Task.Delay(10) + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs index 65918a8a61..8c6a40562d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.codegen.cs @@ -7,14 +7,28 @@ namespace Test using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Components; - using System.Threading.Tasks; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using System.Threading.Tasks; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt index 8e36d86b9e..1451b01b75 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (73:2,12 [91] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (895:22,12 [91] ) +Generated Location: (1164:36,12 [91] ) | Task OnClick(UIMouseEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs index e4707b23ff..2077ed7f73 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.codegen.cs @@ -7,14 +7,28 @@ namespace Test using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Components; - using System.Threading.Tasks; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using System.Threading.Tasks; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async () => await Task.Delay(10))); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + async () => await Task.Delay(10) + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs index c5e24a07a0..b2ba18a31a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.codegen.cs @@ -7,14 +7,28 @@ namespace Test using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Components; - using System.Threading.Tasks; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using System.Threading.Tasks; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt index b85409bbfd..5fb4940060 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (73:2,12 [73] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (895:22,12 [73] ) +Generated Location: (1164:36,12 [73] ) | Task OnClick() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs index ec5a91ec7d..18f9be0443 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>>(() => ParentValue)); builder.CloseComponent(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt index d530d2b830..30ae174fdf 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1493:24,12 [50] ) +Generated Location: (1654:32,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs index 64155cc718..84861fbe8f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue), 2, Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)), 3, () => ParentValue); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ), 2, Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)), 3, () => ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt index 9b00126408..3143063409 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (58:1,12 [65] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime ParentValue { get; set; } = DateTime.Now; | -Generated Location: (1010:20,12 [65] ) +Generated Location: (1175:28,12 [65] ) | public DateTime ParentValue { get; set; } = DateTime.Now; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs index 10a948569c..f51aa5d4f1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt index 4486aeba5f..9d15af3156 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1296:23,12 [50] ) +Generated Location: (1457:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs index eec0221547..7ad0cca670 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt index 17de59870f..1da79407a8 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "42"; | -Generated Location: (1296:23,12 [55] ) +Generated Location: (1457:31,12 [55] ) | public string ParentValue { get; set; } = "42"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs index a820035440..389741c9a7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "OnChanged", new System.Action(__value => ParentValue = __value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt index 5b2390551e..370a63dbef 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (64:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1036:23,12 [50] ) +Generated Location: (1207:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.codegen.cs index 2844fb39e0..08ae8e4a88 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "OnChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.mappings.txt index 12de9c4634..01da3d4890 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (64:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1018:23,12 [50] ) +Generated Location: (1189:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs index 827b96df66..2701fcd7c5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", new System.Action(__value => ParentValue = __value)); builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>>(() => ParentValue)); builder.CloseComponent(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt index b5fc63edaa..ad80c046e4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1236:24,12 [50] ) +Generated Location: (1397:32,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs index 4e6890f2cc..f6b5c27457 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue), 2, __value => ParentValue = __value, 3, () => ParentValue); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ), 2, __value => ParentValue = __value, 3, () => ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt index 9c4e3a4f09..5adac04da0 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression_Generic/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (58:1,12 [65] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime ParentValue { get; set; } = DateTime.Now; | -Generated Location: (853:20,12 [65] ) +Generated Location: (1018:28,12 [65] ) | public DateTime ParentValue { get; set; } = DateTime.Now; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs index 71d845a01d..cd9fa22ba0 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", new System.Action(__value => ParentValue = __value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt index 558e90898f..07bc22cf2f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1039:23,12 [50] ) +Generated Location: (1200:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.codegen.cs index f61f65bd02..06da303e05 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.mappings.txt index c7e08118d6..a5857cf20c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1021:23,12 [50] ) +Generated Location: (1182:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs index cd28df9276..338bcc9db1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", new System.Action(__value => ParentValue = __value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt index 47e83f2182..de7fb15a40 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (54:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "42"; | -Generated Location: (1039:23,12 [55] ) +Generated Location: (1200:31,12 [55] ) | public string ParentValue { get; set; } = "42"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs index 15180e9008..7389e9ca12 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(person.Name))); + builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ValueChanged", new System.Action(__value => person.Name = __value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt index 37f685723b..efa3742449 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) | Person person = new Person(); | -Generated Location: (1028:23,1 [37] ) +Generated Location: (1187:31,1 [37] ) | Person person = new Person(); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs index 5779d8737d..1b486284c0 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "text"); - builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, "MM/dd")); + builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , "MM/dd")); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt index 57a535549c..a824ae7c1c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (91:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | -Generated Location: (1076:24,12 [77] ) +Generated Location: (1253:32,12 [77] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs index ec3af93de9..d2b22f3487 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "text"); - builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt index 140678b60e..956c6c9eac 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (70:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1058:24,12 [50] ) +Generated Location: (1235:32,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs index bd2c1e4f05..3c2a9602ce 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "div"); - builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "myevent", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt index d57ca41968..2f04691a99 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (47:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1003:23,12 [55] ) +Generated Location: (1157:31,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs index bd2c1e4f05..fb9e7ccf67 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "div"); - builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "myevent", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt index df3f32e8c6..2d6dd98cbb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (46:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1003:23,12 [55] ) +Generated Location: (1156:31,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs index bd2c1e4f05..cc1e202b96 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "div"); - builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "myvalue", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "myevent", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt index b60220be5c..d34235b87b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (41:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "hi"; | -Generated Location: (1003:23,12 [55] ) +Generated Location: (1151:31,12 [55] ) | public string ParentValue { get; set; } = "hi"; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs index 62d7d45fd4..dd6890516e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs @@ -22,7 +22,15 @@ namespace Test #nullable disable (builder2) => { builder2.OpenElement(0, "div"); - builder2.AddContent(1, context.ToLowerInvariant()); + builder2.AddContent(1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLowerInvariant() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } #nullable restore @@ -33,7 +41,15 @@ namespace Test #line hidden #nullable disable builder.OpenComponent(2); - builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Components.RenderFragment(header)); + builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Components.RenderFragment( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + header + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => { builder2.AddMarkupContent(5, "\r\n Some Content\r\n"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt index c9a06bc9bd..fb0a544c0a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (577:17,2 [46] ) Source Location: (87:0,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1036:29,87 [2] ) +Generated Location: (1231:37,87 [2] ) |; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs index c4c8bf5d84..2604723d81 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs @@ -22,7 +22,15 @@ namespace Test #nullable disable (builder2) => { builder2.OpenElement(0, "div"); - builder2.AddContent(1, context.ToLowerInvariant()); + builder2.AddContent(1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLowerInvariant() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } #nullable restore @@ -33,7 +41,15 @@ namespace Test #line hidden #nullable disable builder.OpenComponent(2); - builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Components.RenderFragment(header)); + builder.AddAttribute(3, "Header", new Microsoft.AspNetCore.Components.RenderFragment( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + header + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => { builder2.AddContent(5, "Some Content"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt index c9a06bc9bd..fb0a544c0a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (577:17,2 [46] ) Source Location: (87:0,87 [2] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1036:29,87 [2] ) +Generated Location: (1231:37,87 [2] ) |; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs index 533a031330..3be4b8370c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "checkbox"); - builder.AddAttribute(2, "checked", Microsoft.AspNetCore.Components.BindMethods.GetValue(Enabled)); + builder.AddAttribute(2, "checked", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Enabled + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Enabled = __value, Enabled)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt index 919ca5048a..ad6a5295be 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputCheckbox_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (55:1,12 [41] x:\dir\subdir\Test\TestComponent.cshtml) | public bool Enabled { get; set; } | -Generated Location: (1052:24,12 [41] ) +Generated Location: (1218:32,12 [41] ) | public bool Enabled { get; set; } | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs index d0560634aa..ffe3e4a0ef 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,23 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "text"); - builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, Format)); + builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Format + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, Format)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt index 68e5240938..d39523d951 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes/TestComponent.mappings.txt @@ -4,7 +4,7 @@ Source Location: (77:1,12 [135] x:\dir\subdir\Test\TestComponent.cshtml) public string Format { get; set; } = "MM/dd/yyyy"; | -Generated Location: (1074:24,12 [135] ) +Generated Location: (1426:40,12 [135] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs index 737e68cadc..2fa550228a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "text"); - builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(CurrentDate, "MM/dd/yyyy")); + builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CurrentDate + +#line default +#line hidden +#nullable disable + , "MM/dd/yyyy")); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd/yyyy")); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt index e7ea4dbde3..4a1839babb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WithFormat_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (80:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | -Generated Location: (1086:24,12 [77] ) +Generated Location: (1248:32,12 [77] ) | public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs index ec3af93de9..c1df7a309a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenElement(0, "input"); builder.AddAttribute(1, "type", "text"); - builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(2, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt index 121fca4326..5148fb018a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (55:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1058:24,12 [50] ) +Generated Location: (1220:32,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs index d59a828068..bdc5dd0e4e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue)); + builder.AddAttribute(1, "value", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt index 487c48a9a7..330659bde7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithoutType_WritesAttributes/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (43:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1004:23,12 [50] ) +Generated Location: (1154:31,12 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic/TestComponent.codegen.cs index 2a5613c733..c803b3962c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck("hi")); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.codegen.cs index 6a5f0f788a..e4d60257df 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue(Value))); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Value + +#line default +#line hidden +#nullable disable + ))); builder.AddAttribute(2, "ItemChanged", new System.Action(__value => Value = __value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.mappings.txt index 12fda5c105..5ff5ebcdb7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (57:1,12 [21] x:\dir\subdir\Test\TestComponent.cshtml) | string Value; | -Generated Location: (1021:23,12 [21] ) +Generated Location: (1193:31,12 [21] ) | string Value; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.codegen.cs index f75f4a9925..b534c2ad36 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.BindMethods.GetValue(Value)); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Value + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "ItemChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Value = __value, Value)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.mappings.txt index c7cc52a9c7..0f7d1b7f63 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (57:1,12 [21] x:\dir\subdir\Test\TestComponent.cshtml) | string Value; | -Generated Location: (1009:23,12 [21] ) +Generated Location: (1181:31,12 [21] ) | string Value; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.codegen.cs index 2bb60a9fd0..d0e09be7b5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.codegen.cs @@ -13,7 +13,23 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, 18, 2, Microsoft.AspNetCore.Components.BindMethods.GetValue(Value), 3, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Value = __value, Value)); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 18 + +#line default +#line hidden +#nullable disable + , 2, Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Value + +#line default +#line hidden +#nullable disable + ), 3, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Value = __value, Value)); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.mappings.txt index c09eb8ea9f..dd7f79e761 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (56:1,12 [21] x:\dir\subdir\Test\TestComponent.cshtml) | string Value; | -Generated Location: (907:20,12 [21] ) +Generated Location: (1239:36,12 [21] ) | string Value; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.codegen.cs index c51d4cea69..4bb0a503ff 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue(Value), 2, __value => Value = __value); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Value + +#line default +#line hidden +#nullable disable + ), 2, __value => Value = __value); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.mappings.txt index 9e3a748128..b6abf24e37 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBind_TypeInference/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (44:1,12 [21] x:\dir\subdir\Test\TestComponent.cshtml) | string Value; | -Generated Location: (819:20,12 [21] ) +Generated Location: (978:28,12 [21] ) | string Value; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs index 11ecfd2baf..df898bde88 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs @@ -14,11 +14,27 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck("hi")); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (builder2) => { builder2.AddMarkupContent(3, "\r\n "); builder2.OpenElement(4, "div"); - builder2.AddContent(5, context.ToLower()); + builder2.AddContent(5, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); builder2.AddMarkupContent(6, "\r\n"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs index 55bd6f6acc..e11b4bd0a6 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs @@ -13,10 +13,26 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, "hi", 2, (context) => (builder2) => { + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + , 2, (context) => (builder2) => { builder2.AddMarkupContent(3, "\r\n "); builder2.OpenElement(4, "div"); - builder2.AddContent(5, context.ToLower()); + builder2.AddContent(5, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); builder2.AddMarkupContent(6, "\r\n"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute/TestComponent.codegen.cs index 9063b5b71a..f137facb76 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute/TestComponent.codegen.cs @@ -14,8 +14,24 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck("hi")); - builder.AddAttribute(2, "Other", 17); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + )); + builder.AddAttribute(2, "Other", +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 17 + +#line default +#line hidden +#nullable disable + ); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute_TypeInference/TestComponent.codegen.cs index d6a4fa722c..46fef63e3f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericWeaklyTypedAttribute_TypeInference/TestComponent.codegen.cs @@ -13,7 +13,23 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, "hi", 2, 17); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + , 2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 17 + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference/TestComponent.codegen.cs index 703bb94f87..8f0e763387 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, "hi"); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference_Multiple/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference_Multiple/TestComponent.codegen.cs index 36020c2fd2..6625dadf7e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference_Multiple/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_Generic_TypeInference_Multiple/TestComponent.codegen.cs @@ -13,11 +13,35 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, "hi"); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(2, "\r\n"); - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_1(builder, 3, 4, "how are you?"); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_1(builder, 3, 4, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + "how are you?" + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(5, "\r\n"); - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_2(builder, 6, 7, "bye!"); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_2(builder, 6, 7, +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + "bye!" + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.codegen.cs index 99eaf5cdbd..200e63d32a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.codegen.cs @@ -8,7 +8,13 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using Microsoft.AspNetCore.Components.RenderTree; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using Microsoft.AspNetCore.Components.RenderTree; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.mappings.txt index 69d3cf2e78..95294d9331 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InFunctionsDirective/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (56:2,2 [32] x:\dir\subdir\Test\TestComponent.cshtml) | RenderChildComponent(builder); | -Generated Location: (632:18,2 [32] ) +Generated Location: (748:24,2 [32] ) | RenderChildComponent(builder); | Source Location: (105:4,12 [67] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (105:4,12 [67] x:\dir\subdir\Test\TestComponent.cshtml) void RenderChildComponent(RenderTreeBuilder builder) { | -Generated Location: (847:27,12 [67] ) +Generated Location: (963:33,12 [67] ) | void RenderChildComponent(RenderTreeBuilder builder) { @@ -17,7 +17,7 @@ Generated Location: (847:27,12 [67] ) Source Location: (197:8,0 [7] x:\dir\subdir\Test\TestComponent.cshtml) | } | -Generated Location: (1212:40,0 [7] ) +Generated Location: (1328:46,0 [7] ) | } | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.codegen.cs index 4ac820d585..a501aabc85 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.codegen.cs @@ -8,7 +8,13 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using Microsoft.AspNetCore.Components.RenderTree; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using Microsoft.AspNetCore.Components.RenderTree; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.mappings.txt index 8cf6567fd3..235685d4ca 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_InLocalFunction/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (54:1,2 [42] x:\dir\subdir\Test\TestComponent.cshtml) void RenderChildComponent() { | -Generated Location: (632:18,2 [42] ) +Generated Location: (748:24,2 [42] ) | void RenderChildComponent() { @@ -12,12 +12,12 @@ Generated Location: (632:18,2 [42] ) Source Location: (121:5,0 [7] x:\dir\subdir\Test\TestComponent.cshtml) | } | -Generated Location: (988:31,0 [7] ) +Generated Location: (1104:37,0 [7] ) | } | Source Location: (135:8,2 [25] x:\dir\subdir\Test\TestComponent.cshtml) | RenderChildComponent(); | -Generated Location: (1167:39,2 [25] ) +Generated Location: (1283:45,2 [25] ) | RenderChildComponent(); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs index f6334ff26c..7f2919c951 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs @@ -14,16 +14,40 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck("hi")); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (builder2) => { builder2.OpenElement(3, "div"); - builder2.AddContent(4, context.ToLower()); + builder2.AddContent(4, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } )); builder.AddAttribute(5, "AnotherChildContent", (Microsoft.AspNetCore.Components.RenderFragment.Context>)((item) => (builder2) => { builder2.AddMarkupContent(6, "\r\n "); - builder2.AddContent(7, System.Math.Max(0, item.Item)); + builder2.AddContent(7, +#nullable restore +#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" + System.Math.Max(0, item.Item) + +#line default +#line hidden +#nullable disable + ); builder2.AddMarkupContent(8, ";\r\n"); } )); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs index 6821a2b54d..160feb2a42 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs @@ -13,14 +13,46 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, "hi", 2, new List(), 3, (context) => (builder2) => { + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + , 2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + new List() + +#line default +#line hidden +#nullable disable + , 3, (context) => (builder2) => { builder2.OpenElement(4, "div"); - builder2.AddContent(5, context.ToLower()); + builder2.AddContent(5, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } , 6, (item) => (builder2) => { builder2.AddMarkupContent(7, "\r\n "); - builder2.AddContent(8, System.Math.Max(0, item.Item)); + builder2.AddContent(8, +#nullable restore +#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" + System.Math.Max(0, item.Item) + +#line default +#line hidden +#nullable disable + ); builder2.AddMarkupContent(9, ";\r\n"); } ); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs index 74c07bc17b..38a3d12497 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", new System.Action(Increment)); + builder.AddAttribute(1, "OnClick", new System.Action( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt index 336bb2058e..02c2682477 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [100] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (856:22,12 [100] ) +Generated Location: (1015:30,12 [100] ) | private int counter; private void Increment(UIEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs index fcc784f5e9..82d4245939 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenComponent(0); builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (builder2) => { - builder2.AddContent(2, context); + builder2.AddContent(2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context + +#line default +#line hidden +#nullable disable + ); } )); builder.CloseComponent(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitStringParameter/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitStringParameter/TestComponent.codegen.cs index 179d5fa6ad..ba17589a07 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitStringParameter/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitStringParameter/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "StringProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(42.ToString())); + builder.AddAttribute(1, "StringProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 42.ToString() + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs index 1ddbf5a7dd..a0156a97af 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs @@ -19,7 +19,15 @@ namespace Test builder2.AddContent(3, "Some text"); builder2.OpenElement(4, "some-child"); builder2.AddAttribute(5, "a", "1"); - builder2.AddContent(6, context.ToLowerInvariant()); + builder2.AddContent(6, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLowerInvariant() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } )); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs index c014ec7563..d53d350fd5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs @@ -19,7 +19,15 @@ namespace Test builder2.AddMarkupContent(3, "\r\n Some text"); builder2.OpenElement(4, "some-child"); builder2.AddAttribute(5, "a", "1"); - builder2.AddContent(6, item.ToLowerInvariant()); + builder2.AddContent(6, +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + item.ToLowerInvariant() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); builder2.AddMarkupContent(7, "\r\n "); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs index c014ec7563..d53d350fd5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs @@ -19,7 +19,15 @@ namespace Test builder2.AddMarkupContent(3, "\r\n Some text"); builder2.OpenElement(4, "some-child"); builder2.AddAttribute(5, "a", "1"); - builder2.AddContent(6, item.ToLowerInvariant()); + builder2.AddContent(6, +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + item.ToLowerInvariant() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); builder2.AddMarkupContent(7, "\r\n "); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs index bc2495b169..1bbcf6de84 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", new System.Action(e => { Increment(); })); + builder.AddAttribute(1, "OnClick", new System.Action( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + e => { Increment(); } + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt index 97bbec1141..8fe1b9e5e5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (65:2,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (868:22,12 [87] ) +Generated Location: (1028:30,12 [87] ) | private int counter; private void Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithNonPropertyAttributes/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithNonPropertyAttributes/TestComponent.codegen.cs index f603d7e0ab..62827903dc 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithNonPropertyAttributes/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithNonPropertyAttributes/TestComponent.codegen.cs @@ -15,7 +15,15 @@ namespace Test { builder.OpenComponent(0); builder.AddAttribute(1, "some-attribute", "foo"); - builder.AddAttribute(2, "another-attribute", 43.ToString()); + builder.AddAttribute(2, "another-attribute", +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 43.ToString() + +#line default +#line hidden +#nullable disable + ); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithParameters/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithParameters/TestComponent.codegen.cs index 0f959164da..8c62ec60ba 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithParameters/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithParameters/TestComponent.codegen.cs @@ -14,10 +14,34 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "IntProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(123)); - builder.AddAttribute(2, "BoolProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(true)); + builder.AddAttribute(1, "IntProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + 123 + +#line default +#line hidden +#nullable disable + )); + builder.AddAttribute(2, "BoolProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + true + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(3, "StringProperty", "My string"); - builder.AddAttribute(4, "ObjectProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(new SomeType())); + builder.AddAttribute(4, "ObjectProperty", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 5 "x:\dir\subdir\Test\TestComponent.cshtml" + new SomeType() + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.codegen.cs index 9af381f80e..217d4e9f5a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.mappings.txt index 5b31bc0d66..97f074133c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithWeaklyTypeEventHandler/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (53:2,12 [62] x:\dir\subdir\Test\TestComponent.cshtml) | private Action OnClick { get; set; } | -Generated Location: (911:22,12 [62] ) +Generated Location: (1073:30,12 [62] ) | private Action OnClick { get; set; } | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs index f31bf74ba5..8a9d9d24a7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs @@ -8,7 +8,13 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using AnotherTest; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using AnotherTest; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 @@ -23,7 +29,15 @@ namespace Test builder.AddMarkupContent(3, "\r\n"); builder.OpenComponent(4); builder.AddAttribute(5, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (builder2) => { - builder2.AddContent(6, context); + builder2.AddContent(6, +#nullable restore +#line 7 "x:\dir\subdir\Test\TestComponent.cshtml" + context + +#line default +#line hidden +#nullable disable + ); } )); builder.CloseComponent(); @@ -37,7 +51,15 @@ namespace Test builder.AddMarkupContent(11, "\r\n"); builder.OpenComponent(12); builder.AddAttribute(13, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (builder2) => { - builder2.AddContent(14, context); + builder2.AddContent(14, +#nullable restore +#line 13 "x:\dir\subdir\Test\TestComponent.cshtml" + context + +#line default +#line hidden +#nullable disable + ); } )); builder.CloseComponent(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs index 16dfbdf5f8..ccfd6dea9f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs @@ -8,15 +8,35 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using System.Text; - using System.Reflection; +#nullable restore +#line 1 "x:\dir\subdir\Test\_Imports.razor" +using System.Text; + +#line default +#line hidden +#nullable disable +#nullable restore +#line 2 "x:\dir\subdir\Test\_Imports.razor" +using System.Reflection; + +#line default +#line hidden +#nullable disable [Microsoft.AspNetCore.Components.Layouts.LayoutAttribute(typeof(MainLayout))] public class _Imports : System.Object { #pragma warning disable 1998 protected void Execute() { - builder.AddContent(0, Foo); + builder.AddContent(0, +#nullable restore +#line 5 "x:\dir\subdir\Test\_Imports.razor" + Foo + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentParameter_TypeMismatch_ReportsDiagnostic/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentParameter_TypeMismatch_ReportsDiagnostic/TestComponent.codegen.cs index 92ba24b62e..e77381c90e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentParameter_TypeMismatch_ReportsDiagnostic/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentParameter_TypeMismatch_ReportsDiagnostic/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Coolness", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck("very-cool")); + builder.AddAttribute(1, "Coolness", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "very-cool" + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs index e6a9c70265..f30ecf9dd1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs @@ -7,7 +7,13 @@ namespace Test using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; - using Microsoft.AspNetCore.Components; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using Microsoft.AspNetCore.Components; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 @@ -25,7 +31,15 @@ namespace Test builder.AddContent(1, " "); builder.OpenElement(2, "p"); builder.AddMarkupContent(3, "\r\n "); - builder.AddContent(4, ChildContent(item2)); + builder.AddContent(4, +#nullable restore +#line 9 "x:\dir\subdir\Test\TestComponent.cshtml" + ChildContent(item2) + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(5, ";\r\n "); builder.CloseElement(); builder.AddMarkupContent(6, "\r\n"); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt index f0bdf46f77..d4c26ae07f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (98:5,1 [34] x:\dir\subdir\Test\TestComponent.cshtml) |foreach (var item2 in Items2) { | -Generated Location: (656:20,1 [34] ) +Generated Location: (772:26,1 [34] ) |foreach (var item2 in Items2) { | @@ -10,7 +10,7 @@ Generated Location: (656:20,1 [34] ) Source Location: (178:10,0 [3] x:\dir\subdir\Test\TestComponent.cshtml) |} | -Generated Location: (1150:37,0 [3] ) +Generated Location: (1407:51,0 [3] ) |} | @@ -20,7 +20,7 @@ Source Location: (193:11,12 [164] x:\dir\subdir\Test\TestComponent.cshtml) [Parameter] List Items2 { get; set; } [Parameter] RenderFragment ChildContent { get; set; } | -Generated Location: (1335:46,12 [164] ) +Generated Location: (1592:60,12 [164] ) | [Parameter] TItem1 Item1 { get; set; } [Parameter] List Items2 { get; set; } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_IgnoresStaticAndAliasUsings/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_IgnoresStaticAndAliasUsings/TestComponent.codegen.cs index 61d23eb858..2a467f5166 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_IgnoresStaticAndAliasUsings/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_IgnoresStaticAndAliasUsings/TestComponent.codegen.cs @@ -8,8 +8,20 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using static Test2.SomeComponent; - using Foo = Test3; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using static Test2.SomeComponent; + +#line default +#line hidden +#nullable disable +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +using Foo = Test3; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithImportsFile/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithImportsFile/TestComponent.codegen.cs index 9d57530eb2..a26d349655 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithImportsFile/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithImportsFile/TestComponent.codegen.cs @@ -8,8 +8,20 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using System.Text; - using System.Reflection; +#nullable restore +#line 1 "x:\dir\subdir\Test\_Imports.razor" +using System.Text; + +#line default +#line hidden +#nullable disable +#nullable restore +#line 2 "x:\dir\subdir\Test\_Imports.razor" +using System.Reflection; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives/TestComponent.codegen.cs index 78d921a7dd..a9cdccaa49 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives/TestComponent.codegen.cs @@ -8,7 +8,13 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using Test2; +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" +using Test2; + +#line default +#line hidden +#nullable disable [Microsoft.AspNetCore.Components.RouteAttribute("/MyPage")] [Microsoft.AspNetCore.Components.RouteAttribute("/AnotherRoute/{id}")] public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives_AmbiguousImport/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives_AmbiguousImport/TestComponent.codegen.cs index 4d70f17e7d..38abc758cf 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives_AmbiguousImport/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithUsingDirectives_AmbiguousImport/TestComponent.codegen.cs @@ -8,8 +8,20 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using Test2; - using Test3; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using Test2; + +#line default +#line hidden +#nullable disable +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +using Test3; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs index 6ff65a1fd4..57d254f3f5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ExplicitExpression/TestComponent.codegen.cs @@ -23,7 +23,15 @@ namespace Test #nullable disable builder.OpenElement(0, "elem"); builder.AddAttribute(1, "data-abc", "Literal value"); - builder.AddAttribute(2, "data-def", myValue); + builder.AddAttribute(2, "data-def", +#nullable restore +#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" + myValue + +#line default +#line hidden +#nullable disable + ); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs index 6ff65a1fd4..2fa1f89e0c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DataDashAttribute_ImplicitExpression/TestComponent.codegen.cs @@ -23,7 +23,15 @@ namespace Test #nullable disable builder.OpenElement(0, "elem"); builder.AddAttribute(1, "data-abc", "Literal value"); - builder.AddAttribute(2, "data-def", myValue); + builder.AddAttribute(2, "data-def", +#nullable restore +#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" + myValue + +#line default +#line hidden +#nullable disable + ); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.codegen.cs index 0f724347c5..42c89177e0 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, EventCallback.Factory.Create(this, Increment)))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + EventCallback.Factory.Create(this, Increment) + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.mappings.txt index b9cca84192..9847f94f4b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Explicitly/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (107:2,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1119:22,12 [87] ) +Generated Location: (1279:30,12 [87] ) | private int counter; private void Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.codegen.cs index f5beefea6c..8a6dcef3a9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.mappings.txt index 2813586105..ce19ff759b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_Action/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1065:22,12 [87] ) +Generated Location: (1224:30,12 [87] ) | private int counter; private void Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.codegen.cs index 28427a3b91..fba47127eb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.mappings.txt index 1efa219064..b1f0904571 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_ActionOfT/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [105] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1065:22,12 [105] ) +Generated Location: (1224:30,12 [105] ) | private int counter; private void Increment(UIMouseEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.codegen.cs index ba66745821..46b47e62e8 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.mappings.txt index ce649e73e7..4f6d62c7b1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTTask/TestComponent.mappings.txt @@ -6,7 +6,7 @@ Source Location: (51:2,12 [141] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1065:22,12 [141] ) +Generated Location: (1224:30,12 [141] ) | private int counter; private Task Increment(UIMouseEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.codegen.cs index c47ac91cf3..9b610ea347 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.mappings.txt index f4b0eeaa6e..2947d225fe 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_FuncOfTask/TestComponent.mappings.txt @@ -6,7 +6,7 @@ Source Location: (51:2,12 [123] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1065:22,12 [123] ) +Generated Location: (1224:30,12 [123] ) | private int counter; private Task Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.codegen.cs index 2448a55110..e31f3279d2 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.mappings.txt index 2cadf32ae9..773637ed1a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallbackOfT_Implicitly_TypeMismatch/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [106] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1065:22,12 [106] ) +Generated Location: (1224:30,12 [106] ) | private int counter; private void Increment(UIChangeEventArgs e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.codegen.cs index b2759731b7..dd3c834e4a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, EventCallback.Factory.Create(this, Increment)))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + EventCallback.Factory.Create(this, Increment) + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.mappings.txt index 7f5adef081..e8bf5fae09 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Explicitly/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (89:2,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1001:22,12 [87] ) +Generated Location: (1161:30,12 [87] ) | private int counter; private void Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.codegen.cs index d1572e7e20..900bd8565f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.mappings.txt index 899faf534b..429db666d4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_Action/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (965:22,12 [87] ) +Generated Location: (1124:30,12 [87] ) | private int counter; private void Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.codegen.cs index 5ccbac8604..0cf2cd6e74 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.mappings.txt index fc78796673..e13323479a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_ActionOfObject/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (51:2,12 [95] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (965:22,12 [95] ) +Generated Location: (1124:30,12 [95] ) | private int counter; private void Increment(object e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.codegen.cs index d9f310743d..2976e7b94e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.mappings.txt index c518cab355..7227cffb9d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfTask/TestComponent.mappings.txt @@ -6,7 +6,7 @@ Source Location: (51:2,12 [123] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (965:22,12 [123] ) +Generated Location: (1124:30,12 [123] ) | private int counter; private Task Increment() { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.codegen.cs index 1130e16ba4..f8182381e5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, Increment))); + builder.AddAttribute(1, "OnClick", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Increment + +#line default +#line hidden +#nullable disable + ))); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.mappings.txt index 23399a2c4e..a359c2f249 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventCallback_CanPassEventCallback_Implicitly_FuncOfobjectTask/TestComponent.mappings.txt @@ -6,7 +6,7 @@ Source Location: (51:2,12 [131] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (965:22,12 [131] ) +Generated Location: (1124:30,12 [131] ) | private int counter; private Task Increment(object e) { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs index ebefe524b9..a479508721 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt index 7ff716c3ae..0bebeedecd 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_ArbitraryEventName_WithEventArgsMethodGroup/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIEventArgs e) { } | -Generated Location: (895:22,12 [44] ) +Generated Location: (1048:30,12 [44] ) | void OnClick(UIEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs index 837cf43b0b..77134a3d36 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt index 0978efd52f..46ce97fccb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithDelegate/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIMouseEventArgs e) { } | -Generated Location: (895:22,12 [49] ) +Generated Location: (1048:30,12 [49] ) | void OnClick(UIMouseEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs index 232364506d..1b336f0287 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsLambdaDelegate/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, x => { })); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + x => { } + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs index 837cf43b0b..77134a3d36 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt index 0978efd52f..46ce97fccb 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithEventArgsMethodGroup/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick(UIMouseEventArgs e) { } | -Generated Location: (895:22,12 [49] ) +Generated Location: (1048:30,12 [49] ) | void OnClick(UIMouseEventArgs e) { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs index 232364506d..1b336f0287 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithLambdaDelegate/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, x => { })); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + x => { } + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs index 7efe6db82a..89eb60c4e9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick)); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnClick + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt index 7454b955cb..e403687687 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgMethodGroup/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml) void OnClick() { } | -Generated Location: (895:22,12 [31] ) +Generated Location: (1048:30,12 [31] ) | void OnClick() { } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs index a5b091845e..0812f45368 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/EventHandler_OnElement_WithNoArgsLambdaDelegate/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "input"); - builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, () => { })); + builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + () => { } + +#line default +#line hidden +#nullable disable + )); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.codegen.cs index 4595839aa7..4b675e0739 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.codegen.cs @@ -8,13 +8,35 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using Test.Shared; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using Test.Shared; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, 3, 2, Hello); + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + 3 + +#line default +#line hidden +#nullable disable + , 2, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + Hello + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.mappings.txt index 31ad391b84..7972ca277d 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_NonGenericParameter_TypeInference/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (73:3,12 [38] x:\dir\subdir\Test\TestComponent.cshtml) | MyClass Hello = new MyClass(); | -Generated Location: (764:21,12 [38] ) +Generated Location: (1199:43,12 [38] ) | MyClass Hello = new MyClass(); | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.codegen.cs index dbb8b9f1ab..5dd5cacdcd 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent>(0); - builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(3)); + builder.AddAttribute(1, "Item", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 3 + +#line default +#line hidden +#nullable disable + )); builder.AddComponentReferenceCapture(2, (__value) => { #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.mappings.txt index f2c2d0b55b..31a4229259 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (37:0,37 [3] x:\dir\subdir\Test\TestComponent.cshtml) |_my| -Generated Location: (854:20,37 [3] ) +Generated Location: (1019:28,37 [3] ) |_my| Source Location: (60:2,12 [90] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (60:2,12 [90] x:\dir\subdir\Test\TestComponent.cshtml) private MyComponent _my; public void Foo() { System.GC.KeepAlive(_my); } | -Generated Location: (1144:32,12 [90] ) +Generated Location: (1309:40,12 [90] ) | private MyComponent _my; public void Foo() { System.GC.KeepAlive(_my); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.codegen.cs index aef3b40743..29c061442f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, 3, 2, (__value) => { + __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + 3 + +#line default +#line hidden +#nullable disable + , 2, (__value) => { #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" _my = __value; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.mappings.txt index 02cbbdf0b3..f40f6dcbf9 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference/TestComponent.mappings.txt @@ -1,6 +1,6 @@ Source Location: (27:0,27 [3] x:\dir\subdir\Test\TestComponent.cshtml) |_my| -Generated Location: (713:18,27 [3] ) +Generated Location: (868:26,27 [3] ) |_my| Source Location: (50:2,12 [90] x:\dir\subdir\Test\TestComponent.cshtml) @@ -8,7 +8,7 @@ Source Location: (50:2,12 [90] x:\dir\subdir\Test\TestComponent.cshtml) private MyComponent _my; public void Foo() { System.GC.KeepAlive(_my); } | -Generated Location: (941:29,12 [90] ) +Generated Location: (1096:37,12 [90] ) | private MyComponent _my; public void Foo() { System.GC.KeepAlive(_my); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs index 22ee654d48..e07d0e5b88 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs @@ -13,10 +13,26 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - __Blazor.Test.TestComponent.TypeInference.CreateTest_MyComponent_0(builder, 0, 1, "hi", 2, (context) => (builder2) => { + __Blazor.Test.TestComponent.TypeInference.CreateTest_MyComponent_0(builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "hi" + +#line default +#line hidden +#nullable disable + , 2, (context) => (builder2) => { builder2.AddMarkupContent(3, "\r\n "); builder2.OpenElement(4, "div"); - builder2.AddContent(5, context.ToLower()); + builder2.AddContent(5, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + context.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); builder2.AddMarkupContent(6, "\r\n"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs index 4f383fba8a..36283eb0b4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs @@ -13,7 +13,15 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - builder.AddContent(0, "My value"); + builder.AddContent(0, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + "My value" + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(1, "\r\n\r\n"); builder.AddMarkupContent(2, "

Hello

"); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs index 6a835d858e..5a33264673 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithDirective/TestComponent.codegen.cs @@ -7,7 +7,13 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - using System; +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +using System; + +#line default +#line hidden +#nullable disable public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs index 6ff424d4ae..96be7bf80c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs @@ -22,7 +22,15 @@ namespace Test #line hidden #nullable disable builder.OpenElement(0, "div"); - builder.AddContent(1, myValue); + builder.AddContent(1, +#nullable restore +#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" + myValue + +#line default +#line hidden +#nullable disable + ); builder.AddMarkupContent(2, " "); builder.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs index bc435c51df..64dd2ddfe1 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs @@ -19,7 +19,15 @@ namespace Test } )); builder.AddAttribute(3, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => { - builder2.AddContent(4, "bye!"); + builder2.AddContent(4, +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + "bye!" + +#line default +#line hidden +#nullable disable + ); } )); builder.CloseComponent(); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs index 4d9fbbc82e..de3026bce7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs @@ -23,9 +23,25 @@ namespace Test (builder2) => { builder2.OpenElement(0, "li"); builder2.AddContent(1, "#"); - builder2.AddContent(2, context.Index); + builder2.AddContent(2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context.Index + +#line default +#line hidden +#nullable disable + ); builder2.AddContent(3, " - "); - builder2.AddContent(4, context.Item.ToLower()); + builder2.AddContent(4, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + context.Item.ToLower() + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } #nullable restore @@ -36,7 +52,15 @@ namespace Test #line hidden #nullable disable builder.OpenComponent(5); - builder.AddAttribute(6, "Template", new Microsoft.AspNetCore.Components.RenderFragment(template)); + builder.AddAttribute(6, "Template", new Microsoft.AspNetCore.Components.RenderFragment( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + template + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt index af0f1f53fe..351470bca5 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (577:17,2 [54] ) Source Location: (107:0,107 [2] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1209:32,107 [2] ) +Generated Location: (1632:48,107 [2] ) |; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs index 0f0b57a474..23df97ac34 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.codegen.cs @@ -24,7 +24,15 @@ namespace Test (builder2) => { builder2.OpenElement(0, "div"); builder2.OpenComponent(1); - builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(person.Name)); + builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + )); builder2.CloseComponent(); builder2.CloseElement(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt index 6d5ac23a94..d257143ce3 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_ContainsComponent/TestComponent.mappings.txt @@ -8,7 +8,7 @@ Generated Location: (577:17,2 [45] ) Source Location: (93:1,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1211:32,89 [3] ) +Generated Location: (1420:40,89 [3] ) |; | @@ -19,7 +19,7 @@ Source Location: (111:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) public string Name { get; set; } } | -Generated Location: (1395:41,12 [76] ) +Generated Location: (1604:49,12 [76] ) | class Person { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs index fe8b9cb84c..5f264658aa 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs @@ -24,7 +24,15 @@ namespace Test (builder2) => { builder2.OpenElement(0, "div"); builder2.OpenComponent(1); - builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck(person.Name)); + builder2.AddAttribute(2, "Name", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + )); builder2.CloseComponent(); builder2.CloseElement(); } @@ -38,7 +46,15 @@ namespace Test builder.OpenComponent(3); builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => { builder2.AddMarkupContent(5, "\r\n"); - builder2.AddContent(6, "hello, world!"); + builder2.AddContent(6, +#nullable restore +#line 5 "x:\dir\subdir\Test\TestComponent.cshtml" + "hello, world!" + +#line default +#line hidden +#nullable disable + ); builder2.AddMarkupContent(7, "\r\n"); } )); diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt index 74b886d3df..2661679839 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt @@ -8,7 +8,7 @@ Generated Location: (577:17,2 [45] ) Source Location: (93:1,89 [3] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1211:32,89 [3] ) +Generated Location: (1420:40,89 [3] ) |; | @@ -19,7 +19,7 @@ Source Location: (164:7,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) public string Name { get; set; } } | -Generated Location: (1809:49,12 [76] ) +Generated Location: (2160:65,12 [76] ) | class Person { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs index 26d0ddc3d4..6ce4d855b3 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs @@ -22,7 +22,15 @@ namespace Test #nullable disable (builder2) => { builder2.OpenElement(0, "div"); - builder2.AddContent(1, person.Name); + builder2.AddContent(1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } #nullable restore @@ -33,7 +41,15 @@ namespace Test #line hidden #nullable disable builder.OpenComponent(2); - builder.AddAttribute(3, "PersonTemplate", new Microsoft.AspNetCore.Components.RenderFragment(template)); + builder.AddAttribute(3, "PersonTemplate", new Microsoft.AspNetCore.Components.RenderFragment( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + template + +#line default +#line hidden +#nullable disable + )); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt index e331fc92cd..ed1e499e6c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (577:17,2 [47] ) Source Location: (73:0,73 [2] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1008:29,73 [2] ) +Generated Location: (1204:37,73 [2] ) |; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs index 48b234049c..f364a1725a 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs @@ -13,12 +13,35 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - builder.AddContent(0, RenderPerson((person) => (builder2) => { + builder.AddContent(0, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + RenderPerson((person) => + +#line default +#line hidden +#nullable disable + (builder2) => { builder2.OpenElement(1, "div"); - builder2.AddContent(2, person.Name); + builder2.AddContent(2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } - )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ) + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt index 3e0f0c4065..926cfcc93e 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt @@ -7,7 +7,7 @@ Source Location: (65:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) object RenderPerson(RenderFragment p) => null; | -Generated Location: (889:25,12 [138] ) +Generated Location: (1371:48,12 [138] ) | class Person { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs index ae4fd87296..0064cceef4 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs @@ -23,7 +23,15 @@ namespace Test #nullable disable (builder2) => { builder2.OpenElement(0, "div"); - builder2.AddContent(1, person.Name); + builder2.AddContent(1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt index 293049aa96..cac8e70d5c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt @@ -8,7 +8,7 @@ Generated Location: (577:17,2 [45] ) Source Location: (71:1,67 [3] x:\dir\subdir\Test\TestComponent.cshtml) |; | -Generated Location: (1000:30,67 [3] ) +Generated Location: (1190:38,67 [3] ) |; | @@ -19,7 +19,7 @@ Source Location: (89:3,12 [76] x:\dir\subdir\Test\TestComponent.cshtml) public string Name { get; set; } } | -Generated Location: (1184:39,12 [76] ) +Generated Location: (1374:47,12 [76] ) | class Person { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs index 48b234049c..2d556280a3 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs @@ -13,12 +13,35 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - builder.AddContent(0, RenderPerson((person) => (builder2) => { + builder.AddContent(0, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + RenderPerson((person) => + +#line default +#line hidden +#nullable disable + (builder2) => { builder2.OpenElement(1, "div"); - builder2.AddContent(2, person.Name); + builder2.AddContent(2, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + person.Name + +#line default +#line hidden +#nullable disable + ); builder2.CloseElement(); } - )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ) + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt index d5061b73ce..70de3d46f2 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt @@ -7,7 +7,7 @@ Source Location: (67:1,12 [138] x:\dir\subdir\Test\TestComponent.cshtml) object RenderPerson(RenderFragment p) => null; | -Generated Location: (889:25,12 [138] ) +Generated Location: (1374:48,12 [138] ) | class Person { diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs index b105a94a0c..7ccf82557c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_AsComponentParameter/TestComponent.codegen.cs @@ -31,7 +31,15 @@ namespace Test #line hidden #nullable disable builder.OpenComponent(1); - builder.AddAttribute(2, "Person", template); + builder.AddAttribute(2, "Person", +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + template + +#line default +#line hidden +#nullable disable + ); builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs index 6e6aa60e41..b65f8a5b70 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs @@ -13,10 +13,25 @@ namespace Test #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { - builder.AddContent(0, RenderPerson((builder2) => { + builder.AddContent(0, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + RenderPerson( + +#line default +#line hidden +#nullable disable + (builder2) => { builder2.AddMarkupContent(1, "
HI
"); } - )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ) + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 #nullable restore diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt index 7d5e690806..6c03a5d7ab 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (43:1,12 [54] x:\dir\subdir\Test\TestComponent.cshtml) | object RenderPerson(RenderFragment p) => null; | -Generated Location: (796:23,12 [54] ) +Generated Location: (1083:38,12 [54] ) | object RenderPerson(RenderFragment p) => null; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.codegen.cs index 0226f5a2cc..9269013723 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "v", Microsoft.AspNetCore.Components.BindMethods.GetValue(y)); + builder.AddAttribute(1, "v", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + y + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "vChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => y = __value, y)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.mappings.txt index b8f5b52dd8..eef0fcb2e7 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (36:1,12 [24] x:\dir\subdir\Test\TestComponent.cshtml) | string y = null; | -Generated Location: (979:23,12 [24] ) +Generated Location: (1132:31,12 [24] ) | string y = null; | diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.codegen.cs index 706ac66f7a..e586a44f6b 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.codegen.cs @@ -14,9 +14,25 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenComponent(0); - builder.AddAttribute(1, "Name", Microsoft.AspNetCore.Components.BindMethods.GetValue(UserName)); + builder.AddAttribute(1, "Name", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + UserName + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(2, "NameChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => UserName = __value, UserName)); - builder.AddAttribute(3, "IsActive", Microsoft.AspNetCore.Components.BindMethods.GetValue(UserIsActive)); + builder.AddAttribute(3, "IsActive", Microsoft.AspNetCore.Components.BindMethods.GetValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + UserIsActive + +#line default +#line hidden +#nullable disable + )); builder.AddAttribute(4, "IsActiveChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => UserIsActive = __value, UserIsActive)); builder.CloseComponent(); } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.mappings.txt index 46fabcb52b..da0cc7a5bf 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.mappings.txt @@ -3,7 +3,7 @@ Source Location: (76:2,12 [88] x:\dir\subdir\Test\TestComponent.cshtml) public string UserName { get; set; } public bool UserIsActive { get; set; } | -Generated Location: (1301:25,12 [88] ) +Generated Location: (1635:41,12 [88] ) | public string UserName { get; set; } public bool UserIsActive { get; set; } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs index 2f6cc7ba0b..9091a18c52 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.codegen.cs @@ -14,8 +14,24 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "p"); - builder.AddAttribute(1, "onmouseover", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnComponentHover)); - builder.AddAttribute(2, "style", "background:" + " " + (ParentBgColor) + ";"); + builder.AddAttribute(1, "onmouseover", Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + OnComponentHover + +#line default +#line hidden +#nullable disable + )); + builder.AddAttribute(2, "style", "background:" + " " + ( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentBgColor + +#line default +#line hidden +#nullable disable + ) + ";"); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt index 5cf75e5e2c..5a06dbcb9f 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_784/TestComponent.mappings.txt @@ -6,7 +6,7 @@ Source Location: (87:1,12 [132] x:\dir\subdir\Test\TestComponent.cshtml) { } | -Generated Location: (996:23,12 [132] ) +Generated Location: (1340:39,12 [132] ) | public string ParentBgColor { get; set; } = "#FFFFFF"; diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs index c4e95fa8ab..47b5dea50c 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.AddMarkupContent(0, "

Hello

\r\n\r\n"); - builder.AddContent(1, "My value"); + builder.AddContent(1, +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + "My value" + +#line default +#line hidden +#nullable disable + ); } #pragma warning restore 1998 } diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs index 1eed20445e..877a394631 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.codegen.cs @@ -14,7 +14,15 @@ namespace Test protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { builder.OpenElement(0, "elem"); - builder.AddAttribute(1, "attr", Foo); + builder.AddAttribute(1, "attr", +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Foo + +#line default +#line hidden +#nullable disable + ); builder.CloseElement(); } #pragma warning restore 1998 diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt index 72caeebb19..20e3897096 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt +++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (36:1,16 [29] x:\dir\subdir\Test\TestComponent.cshtml) | int Foo = 18; | -Generated Location: (773:22,16 [29] ) +Generated Location: (921:30,16 [29] ) | int Foo = 18; | diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs index 7061c025ee..84ed8ac87f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs @@ -519,6 +519,70 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } + protected void AssertLinePragmas(RazorCodeDocument codeDocument, bool designTime) + { + if (FileName == null) + { + var message = $"{nameof(AssertSourceMappingsMatchBaseline)} should only be called from an integration test. ({nameof(FileName)} is null)."; + throw new InvalidOperationException(message); + } + + var csharpDocument = codeDocument.GetCSharpDocument(); + Assert.NotNull(csharpDocument); + var linePragmas = csharpDocument.LinePragmas; + designTime = false; + if (designTime) + { + var sourceMappings = csharpDocument.SourceMappings; + foreach (var sourceMapping in sourceMappings) + { + var foundMatchingPragma = false; + foreach (var linePragma in linePragmas) + { + if (sourceMapping.OriginalSpan.LineIndex >= linePragma.StartLineIndex && + sourceMapping.OriginalSpan.LineIndex <= linePragma.EndLineIndex) + { + // Found a match. + foundMatchingPragma = true; + break; + } + } + + Assert.True(foundMatchingPragma, $"No line pragma found for code at line {sourceMapping.OriginalSpan.LineIndex + 1}."); + } + } + else + { + var syntaxTree = codeDocument.GetSyntaxTree(); + var sourceBuffer = new char[syntaxTree.Source.Length]; + syntaxTree.Source.CopyTo(0, sourceBuffer, 0, syntaxTree.Source.Length); + var sourceContent = new string(sourceBuffer); + var classifiedSpans = syntaxTree.GetClassifiedSpans(); + foreach (var classifiedSpan in classifiedSpans) + { + var content = sourceContent.Substring(classifiedSpan.Span.AbsoluteIndex, classifiedSpan.Span.Length); + if (!string.IsNullOrWhiteSpace(content) && + classifiedSpan.BlockKind != BlockKindInternal.Directive && + classifiedSpan.SpanKind == SpanKindInternal.Code) + { + var foundMatchingPragma = false; + foreach (var linePragma in linePragmas) + { + if (classifiedSpan.Span.LineIndex >= linePragma.StartLineIndex && + classifiedSpan.Span.LineIndex <= linePragma.EndLineIndex) + { + // Found a match. + foundMatchingPragma = true; + break; + } + } + + Assert.True(foundMatchingPragma, $"No line pragma found for code '{content}' at line {classifiedSpan.Span.LineIndex + 1}."); + } + } + } + } + private class CodeSpanVisitor : SyntaxRewriter { public List CodeSpans { get; } = new List(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorBaselineIntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorBaselineIntegrationTestBase.cs index 60821b285e..1bfa5c033e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorBaselineIntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorBaselineIntegrationTestBase.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Linq; using System.Threading; +using Microsoft.AspNetCore.Razor.Language.Legacy; using Xunit; using Xunit.Sdk; @@ -154,6 +155,66 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests var actualMappings = SourceMappingsSerializer.Serialize(document, codeDocument.Source); actualMappings = actualMappings.Replace("\r", "").Replace("\n", "\r\n"); Assert.Equal(baselineMappings, actualMappings); + + AssertLinePragmas(codeDocument); + } + + protected void AssertLinePragmas(RazorCodeDocument codeDocument) + { + var csharpDocument = codeDocument.GetCSharpDocument(); + Assert.NotNull(csharpDocument); + var linePragmas = csharpDocument.LinePragmas; + if (DesignTime) + { + var sourceMappings = csharpDocument.SourceMappings; + foreach (var sourceMapping in sourceMappings) + { + var foundMatchingPragma = false; + foreach (var linePragma in linePragmas) + { + if (sourceMapping.OriginalSpan.LineIndex >= linePragma.StartLineIndex && + sourceMapping.OriginalSpan.LineIndex <= linePragma.EndLineIndex) + { + // Found a match. + foundMatchingPragma = true; + break; + } + } + + Assert.True(foundMatchingPragma, $"No line pragma found for code at line {sourceMapping.OriginalSpan.LineIndex + 1}."); + } + } + else + { + + var syntaxTree = codeDocument.GetSyntaxTree(); + var sourceBuffer = new char[syntaxTree.Source.Length]; + syntaxTree.Source.CopyTo(0, sourceBuffer, 0, syntaxTree.Source.Length); + var sourceContent = new string(sourceBuffer); + var classifiedSpans = syntaxTree.GetClassifiedSpans(); + foreach (var classifiedSpan in classifiedSpans) + { + var content = sourceContent.Substring(classifiedSpan.Span.AbsoluteIndex, classifiedSpan.Span.Length); + if (!string.IsNullOrWhiteSpace(content) && + classifiedSpan.BlockKind != BlockKindInternal.Directive && + classifiedSpan.SpanKind == SpanKindInternal.Code) + { + var foundMatchingPragma = false; + foreach (var linePragma in linePragmas) + { + if (classifiedSpan.Span.LineIndex >= linePragma.StartLineIndex && + classifiedSpan.Span.LineIndex <= linePragma.EndLineIndex) + { + // Found a match. + foundMatchingPragma = true; + break; + } + } + + Assert.True(foundMatchingPragma, $"No line pragma found for code '{content}' at line {classifiedSpan.Span.LineIndex + 1}."); + } + } + } } private string GetBaselineFilePath(RazorCodeDocument codeDocument, string extension) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs index 40d95625f4..b5b44afa12 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text; -using Microsoft.AspNetCore.Razor.Language.Legacy; namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests {