Verify line pragmas on generated code (dotnet/aspnetcore-tooling#392)

* Verify line pragmas on generated code
\n\nCommit migrated from ca33b2d51b
This commit is contained in:
Ajay Bhargav Baaskaran 2019-04-22 14:43:13 -07:00 committed by GitHub
parent 956606ee5d
commit 43824a4c12
237 changed files with 1973 additions and 368 deletions

View File

@ -42,6 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
var diagnostics = compiled.Compilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning); 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()); 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 // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
Assert.Equal("RZ1014", Assert.Single(diagnotics).Id); Assert.Equal("RZ1014", Assert.Single(diagnotics).Id);
@ -82,6 +84,7 @@ public class MyService<TModel>
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
// We expect this test to generate a bunch of errors. // We expect this test to generate a bunch of errors.
Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0);
@ -116,6 +119,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -148,6 +152,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -162,6 +167,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
Assert.Equal("RZ1016", Assert.Single(diagnotics).Id); Assert.Equal("RZ1016", Assert.Single(diagnotics).Id);
@ -179,6 +185,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -193,6 +200,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -216,6 +224,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -230,6 +239,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -251,6 +261,7 @@ public class MyApp
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -281,6 +292,7 @@ public class MyApp
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -312,6 +324,7 @@ public class MyService<TModel>
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -327,6 +340,7 @@ public class MyService<TModel>
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -350,6 +364,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -371,6 +386,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -385,6 +401,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -406,6 +423,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -420,6 +438,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -434,6 +453,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -464,6 +484,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
} }
[Fact] [Fact]
@ -478,6 +499,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: false);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
Assert.Equal("RZ3906", Assert.Single(diagnotics).Id); Assert.Equal("RZ3906", Assert.Single(diagnotics).Id);
@ -498,6 +520,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
var diagnostics = compiled.Compilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning); var diagnostics = compiled.Compilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning);
@ -516,6 +539,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
@ -540,6 +564,7 @@ public class MyService<TModel>
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
// We expect this test to generate a bunch of errors. // We expect this test to generate a bunch of errors.
@ -575,6 +600,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -609,6 +635,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -624,6 +651,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
@ -642,6 +670,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -657,6 +686,7 @@ public class MyModel
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -681,6 +711,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -696,6 +727,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -718,6 +750,7 @@ public class MyApp
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -749,6 +782,7 @@ public class MyApp
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -781,6 +815,7 @@ public class MyService<TModel>
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -796,6 +831,7 @@ public class MyService<TModel>
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -817,6 +853,7 @@ public class ThisShouldBeGenerated
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
@ -844,6 +881,7 @@ public class InputTestTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -866,6 +904,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -881,6 +920,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -903,6 +943,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -918,6 +959,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -933,6 +975,7 @@ public class DivTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -964,6 +1007,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
} }
@ -979,6 +1023,7 @@ public class AllTagHelper : {typeof(TagHelper).FullName}
// Assert // Assert
AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument());
AssertLinePragmas(compiled.CodeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(compiled.CodeDocument); AssertSourceMappingsMatchBaseline(compiled.CodeDocument);
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;

View File

@ -30,13 +30,15 @@ IDisposable __typeHelper = default(IDisposable);
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o =
#nullable restore #nullable restore
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" #line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml"
__o = this.ToString(); this.ToString()
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
;
#nullable restore #nullable restore
#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml" #line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml"
__o = string.Format("{0}", "Hello"); __o = string.Format("{0}", "Hello");

View File

@ -5,19 +5,19 @@ Generated Location: (641:17,0 [11] )
Source Location: (38:1,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) Source Location: (38:1,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml)
|this.ToString()| |this.ToString()|
Generated Location: (1231:34,13 [15] ) Generated Location: (1251:35,13 [15] )
|this.ToString()| |this.ToString()|
Source Location: (79:3,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) Source Location: (79:3,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml)
|string.Format("{0}", "Hello")| |string.Format("{0}", "Hello")|
Generated Location: (1414:41,6 [29] ) Generated Location: (1448:43,6 [29] )
|string.Format("{0}", "Hello")| |string.Format("{0}", "Hello")|
Source Location: (132:6,12 [37] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml) Source Location: (132:6,12 [37] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml)
| |
void IDisposable.Dispose(){ } void IDisposable.Dispose(){ }
| |
Generated Location: (1666:50,12 [37] ) Generated Location: (1700:52,12 [37] )
| |
void IDisposable.Dispose(){ } void IDisposable.Dispose(){ }
| |

View File

@ -15,9 +15,25 @@ namespace __GeneratedComponent
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "div"); 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.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.AddMarkupContent(4, "\r\n");
builder.CloseElement(); builder.CloseElement();
} }

View File

@ -1,7 +1,6 @@
// 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. // 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 System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Language.Intermediate; 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);
public abstract void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer); public abstract void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer);
public virtual void AddLinePragma(LinePragma linePragma)
{
}
} }
} }

View File

@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
return NullDisposable.Default; 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) private static void WriteVerbatimStringLiteral(CodeWriter writer, string literal)
@ -596,13 +596,16 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
private class LinePragmaWriter : IDisposable private class LinePragmaWriter : IDisposable
{ {
private readonly CodeWriter _writer; private readonly CodeWriter _writer;
private readonly RazorCodeGenerationOptions _codeGenerationOptions; private readonly CodeRenderingContext _context;
private readonly int _startIndent; private readonly int _startIndent;
private readonly int _sourceLineIndex;
private readonly int _startLineIndex;
private readonly string _sourceFilePath;
public LinePragmaWriter( public LinePragmaWriter(
CodeWriter writer, CodeWriter writer,
SourceSpan span, SourceSpan span,
RazorCodeGenerationOptions codeGenerationOptions) CodeRenderingContext context)
{ {
if (writer == null) if (writer == null)
{ {
@ -610,11 +613,13 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
} }
_writer = writer; _writer = writer;
_codeGenerationOptions = codeGenerationOptions; _context = context;
_startIndent = _writer.CurrentIndent; _startIndent = _writer.CurrentIndent;
_sourceFilePath = span.FilePath;
_sourceLineIndex = span.LineIndex;
_writer.CurrentIndent = 0; _writer.CurrentIndent = 0;
if (!_codeGenerationOptions.SuppressNullabilityEnforcement) if (!_context.Options.SuppressNullabilityEnforcement)
{ {
var endsWithNewline = _writer.Length > 0 && _writer[_writer.Length - 1] == '\n'; var endsWithNewline = _writer.Length > 0 && _writer[_writer.Length - 1] == '\n';
if (!endsWithNewline) if (!endsWithNewline)
@ -625,6 +630,9 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
} }
WriteLineNumberDirective(writer, span); WriteLineNumberDirective(writer, span);
// Capture the line index after writing the #line directive.
_startLineIndex = writer.Location.LineIndex;
} }
public void Dispose() public void Dispose()
@ -642,16 +650,21 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
_writer.WriteLine(); _writer.WriteLine();
} }
var lineCount = _writer.Location.LineIndex - _startLineIndex;
var linePragma = new LinePragma(_sourceLineIndex, lineCount, _sourceFilePath);
_context.AddLinePragma(linePragma);
_writer _writer
.WriteLine("#line default") .WriteLine("#line default")
.WriteLine("#line hidden"); .WriteLine("#line hidden");
if (!_codeGenerationOptions.SuppressNullabilityEnforcement) if (!_context.Options.SuppressNullabilityEnforcement)
{ {
_writer.WriteLine("#nullable disable"); _writer.WriteLine("#nullable disable");
} }
_writer.CurrentIndent = _startIndent; _writer.CurrentIndent = _startIndent;
} }
} }

View File

@ -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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
@ -56,6 +55,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
Diagnostics = new RazorDiagnosticCollection(); Diagnostics = new RazorDiagnosticCollection();
Items = new ItemCollection(); Items = new ItemCollection();
SourceMappings = new List<SourceMapping>(); SourceMappings = new List<SourceMapping>();
LinePragmas = new List<LinePragma>();
var diagnostics = _documentNode.GetAllDiagnostics(); var diagnostics = _documentNode.GetAllDiagnostics();
for (var i = 0; i < diagnostics.Count; i++) for (var i = 0; i < diagnostics.Count; i++)
@ -94,6 +94,8 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
public List<SourceMapping> SourceMappings { get; } public List<SourceMapping> SourceMappings { get; }
internal List<LinePragma> LinePragmas { get; }
public override IntermediateNodeWriter NodeWriter => Current.Writer; public override IntermediateNodeWriter NodeWriter => Current.Writer;
public override RazorCodeGenerationOptions Options { get; } public override RazorCodeGenerationOptions Options { get; }
@ -200,6 +202,11 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
_scopes.RemoveAt(_scopes.Count - 1); _scopes.RemoveAt(_scopes.Count - 1);
} }
public override void AddLinePragma(LinePragma linePragma)
{
LinePragmas.Add(linePragma);
}
private struct ScopeInternal private struct ScopeInternal
{ {
public ScopeInternal(IntermediateNodeWriter writer) public ScopeInternal(IntermediateNodeWriter writer)

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.Razor.Language.Intermediate; using Microsoft.AspNetCore.Razor.Language.Intermediate;
namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
@ -47,7 +46,8 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
cSharp, cSharp,
_options, _options,
context.Diagnostics.ToArray(), context.Diagnostics.ToArray(),
context.SourceMappings.ToArray()); context.SourceMappings.ToArray(),
context.LinePragmas.ToArray());
} }
private class Visitor : IntermediateNodeVisitor private class Visitor : IntermediateNodeVisitor

View File

@ -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<LinePragma>
{
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);
}
}
}

View File

@ -244,54 +244,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return; return;
} }
var firstChild = node.Children[0]; context.CodeWriter.WriteStartAssignment(DesignTimeVariable);
if (firstChild.Source != null) 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; WriteCSharpToken(context, token);
context.CodeWriter.WritePadding(offset, firstChild.Source, context); }
context.CodeWriter.WriteStartAssignment(DesignTimeVariable); else
{
for (var i = 0; i < node.Children.Count; i++) // There may be something else inside the expression like a Template or another extension node.
{ context.RenderNode(node.Children[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(";");
} }
} }
else context.CodeWriter.WriteLine(";");
{
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(";");
}
} }
public override void WriteHtmlContent(CodeRenderingContext context, HtmlContentIntermediateNode node) public override void WriteHtmlContent(CodeRenderingContext context, HtmlContentIntermediateNode node)

View File

@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
{ {
if (node.Children[i] is IntermediateToken token && token.IsCSharp) if (node.Children[i] is IntermediateToken token && token.IsCSharp)
{ {
context.CodeWriter.Write(token.Content); WriteCSharpToken(context, token);
} }
else else
{ {
@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
Debug.Assert(_currentAttributeValues.Count == 0); Debug.Assert(_currentAttributeValues.Count == 0);
context.RenderChildren(node); context.RenderChildren(node);
WriteAttribute(context.CodeWriter, node.AttributeName, _currentAttributeValues); WriteAttribute(context, node.AttributeName, _currentAttributeValues);
_currentAttributeValues.Clear(); _currentAttributeValues.Clear();
} }
@ -282,7 +282,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(node)); 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) 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++) for (var i = 0; i < tokens.Count; i++)
{ {
context.CodeWriter.Write(tokens[i].Content); WriteCSharpToken(context, tokens[i]);
} }
if (canTypeCheck) if (canTypeCheck)
@ -520,7 +530,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
for (var i = 0; i < tokens.Count; i++) for (var i = 0; i < tokens.Count; i++)
{ {
context.CodeWriter.Write(tokens[i].Content); WriteCSharpToken(context, tokens[i]);
} }
context.CodeWriter.Write(")"); context.CodeWriter.Write(")");
@ -543,7 +553,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
for (var i = 0; i < tokens.Count; i++) for (var i = 0; i < tokens.Count; i++)
{ {
context.CodeWriter.Write(tokens[i].Content); WriteCSharpToken(context, tokens[i]);
} }
if (canTypeCheck && NeedsTypeCheck(node)) if (canTypeCheck && NeedsTypeCheck(node))
@ -690,11 +700,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
} }
private void WriteAttribute(CodeWriter codeWriter, string key, IList<IntermediateToken> value) private void WriteAttribute(CodeRenderingContext context, string key, IList<IntermediateToken> value)
{ {
BeginWriteAttribute(codeWriter, key); BeginWriteAttribute(context.CodeWriter, key);
WriteAttributeValue(codeWriter, value); WriteAttributeValue(context, value);
codeWriter.WriteEndMethodInvocation(); context.CodeWriter.WriteEndMethodInvocation();
} }
protected override void BeginWriteAttribute(CodeWriter codeWriter, string key) 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 // Only the mixed case is complicated, we want to turn it into code that will concatenate
// the values into a string at runtime. // the values into a string at runtime.
private static void WriteAttributeValue(CodeWriter writer, IList<IntermediateToken> tokens) private static void WriteAttributeValue(CodeRenderingContext context, IList<IntermediateToken> tokens)
{ {
if (tokens == null) if (tokens == null)
{ {
throw new ArgumentNullException(nameof(tokens)); throw new ArgumentNullException(nameof(tokens));
} }
var writer = context.CodeWriter;
var hasHtml = false; var hasHtml = false;
var hasCSharp = false; var hasCSharp = false;
for (var i = 0; i < tokens.Count; i++) for (var i = 0; i < tokens.Count; i++)
@ -770,7 +781,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
insideCSharp = true; insideCSharp = true;
} }
writer.Write(token.Content); WriteCSharpToken(context, token);
} }
else else
{ {
@ -796,7 +807,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
else if (hasCSharp) else if (hasCSharp)
{ {
writer.Write(string.Join("", tokens.Select(t => t.Content))); foreach (var token in tokens)
{
WriteCSharpToken(context, token);
}
} }
else if (hasHtml) else if (hasHtml)
{ {
@ -808,5 +822,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
writer.Write("true"); 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);
}
}
} }
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
@ -11,13 +12,15 @@ namespace Microsoft.AspNetCore.Razor.Language
private readonly string _generatedCode; private readonly string _generatedCode;
private readonly RazorDiagnostic[] _diagnostics; private readonly RazorDiagnostic[] _diagnostics;
private readonly SourceMapping[] _sourceMappings; private readonly SourceMapping[] _sourceMappings;
private readonly LinePragma[] _linePragmas;
private readonly RazorCodeGenerationOptions _options; private readonly RazorCodeGenerationOptions _options;
public DefaultRazorCSharpDocument( public DefaultRazorCSharpDocument(
string generatedCode, string generatedCode,
RazorCodeGenerationOptions options, RazorCodeGenerationOptions options,
RazorDiagnostic[] diagnostics, RazorDiagnostic[] diagnostics,
SourceMapping[] sourceMappings) SourceMapping[] sourceMappings,
LinePragma[] linePragmas)
{ {
if (generatedCode == null) if (generatedCode == null)
{ {
@ -34,6 +37,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_diagnostics = diagnostics ?? Array.Empty<RazorDiagnostic>(); _diagnostics = diagnostics ?? Array.Empty<RazorDiagnostic>();
_sourceMappings = sourceMappings ?? Array.Empty<SourceMapping>(); _sourceMappings = sourceMappings ?? Array.Empty<SourceMapping>();
_linePragmas = linePragmas ?? Array.Empty<LinePragma>();
} }
public override IReadOnlyList<RazorDiagnostic> Diagnostics => _diagnostics; public override IReadOnlyList<RazorDiagnostic> Diagnostics => _diagnostics;
@ -42,6 +46,8 @@ namespace Microsoft.AspNetCore.Razor.Language
public override IReadOnlyList<SourceMapping> SourceMappings => _sourceMappings; public override IReadOnlyList<SourceMapping> SourceMappings => _sourceMappings;
internal override IReadOnlyList<LinePragma> LinePragmas => _linePragmas;
public override RazorCodeGenerationOptions Options => _options; public override RazorCodeGenerationOptions Options => _options;
} }
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
@ -17,6 +18,8 @@ namespace Microsoft.AspNetCore.Razor.Language
public abstract RazorCodeGenerationOptions Options { get; } public abstract RazorCodeGenerationOptions Options { get; }
internal virtual IReadOnlyList<LinePragma> LinePragmas { get; }
public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable<RazorDiagnostic> diagnostics) public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable<RazorDiagnostic> diagnostics)
{ {
if (generatedCode == null) if (generatedCode == null)
@ -34,14 +37,15 @@ namespace Microsoft.AspNetCore.Razor.Language
throw new ArgumentNullException(nameof(diagnostics)); 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( public static RazorCSharpDocument Create(
string generatedCode, string generatedCode,
RazorCodeGenerationOptions options, RazorCodeGenerationOptions options,
IEnumerable<RazorDiagnostic> diagnostics, IEnumerable<RazorDiagnostic> diagnostics,
IEnumerable<SourceMapping> sourceMappings) IEnumerable<SourceMapping> sourceMappings,
IEnumerable<LinePragma> linePragmas)
{ {
if (generatedCode == null) if (generatedCode == null)
{ {
@ -63,7 +67,7 @@ namespace Microsoft.AspNetCore.Razor.Language
throw new ArgumentNullException(nameof(sourceMappings)); 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());
} }
} }
} }

View File

@ -979,6 +979,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(codeDocument); AssertSourceMappingsMatchBaseline(codeDocument);
AssertLinePragmas(codeDocument, designTime: true);
} }
private void RunTimeTest() private void RunTimeTest()
@ -1002,6 +1003,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
// Assert // Assert
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertLinePragmas(codeDocument, designTime: false);
} }
private void RunRuntimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors) private void RunRuntimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors)

View File

@ -32,6 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
// Assert // Assert
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode()); AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument()); AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertLinePragmas(codeDocument, designTime: true);
AssertSourceMappingsMatchBaseline(codeDocument); AssertSourceMappingsMatchBaseline(codeDocument);
} }
} }

View File

@ -26,7 +26,15 @@ using System.Threading.Tasks;
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, async (e) => await Task.Delay(10)); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(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 #pragma warning restore 1998
} }

View File

@ -5,6 +5,6 @@ Generated Location: (285:11,0 [28] )
Source Location: (49:1,18 [33] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (49:1,18 [33] x:\dir\subdir\Test\TestComponent.cshtml)
|async (e) => await Task.Delay(10)| |async (e) => await Task.Delay(10)|
Generated Location: (1024:28,135 [33] ) Generated Location: (1114:31,18 [33] )
|async (e) => await Task.Delay(10)| |async (e) => await Task.Delay(10)|

View File

@ -26,7 +26,15 @@ using System.Threading.Tasks;
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -5,7 +5,7 @@ Generated Location: (285:11,0 [28] )
Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (1024:28,135 [7] ) Generated Location: (1113:31,17 [7] )
|OnClick| |OnClick|
Source Location: (73:2,12 [91] x:\dir\subdir\Test\TestComponent.cshtml) 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; return Task.CompletedTask;
} }
| |
Generated Location: (1166:33,12 [91] ) Generated Location: (1319:41,12 [91] )
| |
Task OnClick(UIMouseEventArgs e) Task OnClick(UIMouseEventArgs e)
{ {

View File

@ -26,7 +26,15 @@ using System.Threading.Tasks;
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, async () => await Task.Delay(10)); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(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 #pragma warning restore 1998
} }

View File

@ -5,6 +5,6 @@ Generated Location: (285:11,0 [28] )
Source Location: (49:1,18 [32] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (49:1,18 [32] x:\dir\subdir\Test\TestComponent.cshtml)
|async () => await Task.Delay(10)| |async () => await Task.Delay(10)|
Generated Location: (1024:28,135 [32] ) Generated Location: (1114:31,18 [32] )
|async () => await Task.Delay(10)| |async () => await Task.Delay(10)|

View File

@ -26,7 +26,15 @@ using System.Threading.Tasks;
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -5,7 +5,7 @@ Generated Location: (285:11,0 [28] )
Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (1024:28,135 [7] ) Generated Location: (1113:31,17 [7] )
|OnClick| |OnClick|
Source Location: (73:2,12 [73] x:\dir\subdir\Test\TestComponent.cshtml) 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; return Task.CompletedTask;
} }
| |
Generated Location: (1166:33,12 [73] ) Generated Location: (1319:41,12 [73] )
| |
Task OnClick() Task OnClick()
{ {

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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"); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd");
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|CurrentDate| |CurrentDate|
Generated Location: (844:22,71 [11] ) Generated Location: (957:25,41 [11] )
|CurrentDate| |CurrentDate|
Source Location: (91:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (91:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); 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); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (41:0,41 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (957:25,41 [11] )
|ParentValue| |ParentValue|
Source Location: (70:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (70:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1130:28,12 [50] ) Generated Location: (1307:36,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (934:25,18 [11] )
|ParentValue| |ParentValue|
Source Location: (47:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (47:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1130:28,12 [55] ) Generated Location: (1284:36,12 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (933:25,17 [11] )
|ParentValue| |ParentValue|
Source Location: (46:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (46:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1130:28,12 [55] ) Generated Location: (1283:36,12 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (12:0,12 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (12:0,12 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (928:25,12 [11] )
|ParentValue| |ParentValue|
Source Location: (41:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (41:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1130:28,12 [55] ) Generated Location: (1278:36,12 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => Enabled = __value, Enabled);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (30:0,30 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (30:0,30 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|Enabled| |Enabled|
Generated Location: (844:22,71 [7] ) Generated Location: (946:25,30 [7] )
|Enabled| |Enabled|
Source Location: (55:1,12 [41] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (55:1,12 [41] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public bool Enabled { get; set; } public bool Enabled { get; set; }
| |
Generated Location: (1118:28,12 [41] ) Generated Location: (1284:36,12 [41] )
| |
public bool Enabled { get; set; } public bool Enabled { get; set; }
| |

View File

@ -20,7 +20,23 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, Format);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,11 +1,11 @@
Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|CurrentDate| |CurrentDate|
Generated Location: (844:22,71 [11] ) Generated Location: (942:25,26 [11] )
|CurrentDate| |CurrentDate|
Source Location: (54:0,54 [6] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (54:0,54 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|Format| |Format|
Generated Location: (857:22,84 [6] ) Generated Location: (1145:33,54 [6] )
|Format| |Format|
Source Location: (77:1,12 [135] x:\dir\subdir\Test\TestComponent.cshtml) 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"; 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); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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"); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd/yyyy");
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|CurrentDate| |CurrentDate|
Generated Location: (844:22,71 [11] ) Generated Location: (942:25,26 [11] )
|CurrentDate| |CurrentDate|
Source Location: (80:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (80:1,12 [77] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); 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); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (942:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (55:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (55:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1130:28,12 [50] ) Generated Location: (1292:36,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue);
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -1,13 +1,13 @@
Source Location: (14:0,14 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (14:0,14 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (844:22,71 [11] ) Generated Location: (930:25,14 [11] )
|ParentValue| |ParentValue|
Source Location: (43:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (43:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1130:28,12 [50] ) Generated Location: (1280:36,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -28,13 +28,15 @@ namespace Test
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
__o =
#nullable restore #nullable restore
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" #line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = myValue; myValue
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
;
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -9,6 +9,6 @@ Generated Location: (845:24,2 [40] )
Source Location: (88:3,43 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (88:3,43 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|myValue| |myValue|
Generated Location: (1048:32,43 [7] ) Generated Location: (1068:33,43 [7] )
|myValue| |myValue|

View File

@ -28,13 +28,15 @@ namespace Test
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
__o =
#nullable restore #nullable restore
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml" #line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = myValue; myValue
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
;
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -9,6 +9,6 @@ Generated Location: (845:24,2 [40] )
Source Location: (87:3,42 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (87:3,42 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|myValue| |myValue|
Generated Location: (1047:32,42 [7] ) Generated Location: (1067:33,42 [7] )
|myValue| |myValue|

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,6 +1,6 @@
Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (908:22,135 [7] ) Generated Location: (997:25,17 [7] )
|OnClick| |OnClick|
Source Location: (42:1,12 [44] x:\dir\subdir\Test\TestComponent.cshtml) 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) { void OnClick(UIEventArgs e) {
} }
| |
Generated Location: (1050:27,12 [44] ) Generated Location: (1203:35,12 [44] )
| |
void OnClick(UIEventArgs e) { void OnClick(UIEventArgs e) {
} }

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,6 +1,6 @@
Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (908:22,135 [7] ) Generated Location: (997:25,17 [7] )
|OnClick| |OnClick|
Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) 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) { void OnClick(UIMouseEventArgs e) {
} }
| |
Generated Location: (1050:27,12 [49] ) Generated Location: (1203:35,12 [49] )
| |
void OnClick(UIMouseEventArgs e) { void OnClick(UIMouseEventArgs e) {
} }

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, x => { }); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
x => { }
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -1,5 +1,5 @@
Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|x => { }| |x => { }|
Generated Location: (908:22,135 [8] ) Generated Location: (998:25,18 [8] )
|x => { }| |x => { }|

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,6 +1,6 @@
Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (908:22,135 [7] ) Generated Location: (997:25,17 [7] )
|OnClick| |OnClick|
Source Location: (42:1,12 [49] x:\dir\subdir\Test\TestComponent.cshtml) 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) { void OnClick(UIMouseEventArgs e) {
} }
| |
Generated Location: (1050:27,12 [49] ) Generated Location: (1203:35,12 [49] )
| |
void OnClick(UIMouseEventArgs e) { void OnClick(UIMouseEventArgs e) {
} }

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, x => { }); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
x => { }
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -1,5 +1,5 @@
Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (18:0,18 [8] x:\dir\subdir\Test\TestComponent.cshtml)
|x => { }| |x => { }|
Generated Location: (908:22,135 [8] ) Generated Location: (998:25,18 [8] )
|x => { }| |x => { }|

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,6 +1,6 @@
Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (908:22,135 [7] ) Generated Location: (997:25,17 [7] )
|OnClick| |OnClick|
Source Location: (42:1,12 [31] x:\dir\subdir\Test\TestComponent.cshtml) 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() { void OnClick() {
} }
| |
Generated Location: (1050:27,12 [31] ) Generated Location: (1203:35,12 [31] )
| |
void OnClick() { void OnClick() {
} }

View File

@ -20,7 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, () => { }); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
() => { }
#line default
#line hidden
#nullable disable
);
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -1,5 +1,5 @@
Source Location: (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml)
|() => { }| |() => { }|
Generated Location: (908:22,135 [9] ) Generated Location: (998:25,18 [9] )
|() => { }| |() => { }|

View File

@ -20,14 +20,24 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnComponentHover); __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = ParentBgColor; OnComponentHover
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
);
__o =
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentBgColor
#line default
#line hidden
#nullable disable
;
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,11 +1,11 @@
Source Location: (17:0,17 [16] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (17:0,17 [16] x:\dir\subdir\Test\TestComponent.cshtml)
|OnComponentHover| |OnComponentHover|
Generated Location: (908:22,135 [16] ) Generated Location: (997:25,17 [16] )
|OnComponentHover| |OnComponentHover|
Source Location: (55:0,55 [13] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (55:0,55 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentBgColor| |ParentBgColor|
Generated Location: (1053:25,55 [13] ) Generated Location: (1226:34,55 [13] )
|ParentBgColor| |ParentBgColor|
Source Location: (87:1,12 [132] x:\dir\subdir\Test\TestComponent.cshtml) 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"; public string ParentBgColor { get; set; } = "#FFFFFF";

View File

@ -20,13 +20,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
__o =
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = Foo; Foo
#line default #line default
#line hidden #line hidden
#nullable disable #nullable disable
;
} }
#pragma warning restore 1998 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -1,13 +1,13 @@
Source Location: (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|Foo| |Foo|
Generated Location: (855:24,12 [3] ) Generated Location: (875:25,12 [3] )
|Foo| |Foo|
Source Location: (36:1,16 [29] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (36:1,16 [29] x:\dir\subdir\Test\TestComponent.cshtml)
| |
int Foo = 18; int Foo = 18;
| |
Generated Location: (1046:33,16 [29] ) Generated Location: (1080:35,16 [29] )
| |
int Foo = 18; int Foo = 18;
| |

View File

@ -7,14 +7,28 @@ namespace Test
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components; 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 public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{ {
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, async (e) => await Task.Delay(10))); builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(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(); builder.CloseElement();
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -7,14 +7,28 @@ namespace Test
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components; 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 public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{ {
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick)); builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
));
builder.CloseElement(); builder.CloseElement();
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -5,7 +5,7 @@ Source Location: (73:2,12 [91] x:\dir\subdir\Test\TestComponent.cshtml)
return Task.CompletedTask; return Task.CompletedTask;
} }
| |
Generated Location: (895:22,12 [91] ) Generated Location: (1164:36,12 [91] )
| |
Task OnClick(UIMouseEventArgs e) Task OnClick(UIMouseEventArgs e)
{ {

View File

@ -7,14 +7,28 @@ namespace Test
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components; 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 public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{ {
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, async () => await Task.Delay(10))); builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
async () => await Task.Delay(10)
#line default
#line hidden
#nullable disable
));
builder.CloseElement(); builder.CloseElement();
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -7,14 +7,28 @@ namespace Test
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components; 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 public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{ {
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, OnClick)); builder.AddAttribute(1, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick
#line default
#line hidden
#nullable disable
));
builder.CloseElement(); builder.CloseElement();
} }
#pragma warning restore 1998 #pragma warning restore 1998

View File

@ -5,7 +5,7 @@ Source Location: (73:2,12 [73] x:\dir\subdir\Test\TestComponent.cshtml)
return Task.CompletedTask; return Task.CompletedTask;
} }
| |
Generated Location: (895:22,12 [73] ) Generated Location: (1164:36,12 [73] )
| |
Task OnClick() Task OnClick()
{ {

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue))));
builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue)); builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue));
builder.CloseComponent(); builder.CloseComponent();

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1493:24,12 [50] ) Generated Location: (1654:32,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -13,7 +13,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -2,7 +2,7 @@ Source Location: (58:1,12 [65] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime ParentValue { get; set; } = DateTime.Now; 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; public DateTime ParentValue { get; set; } = DateTime.Now;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue))));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1296:23,12 [50] ) Generated Location: (1457:31,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)))); builder.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<System.Int32>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<System.Int32>(this, Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue))));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |
Generated Location: (1296:23,12 [55] ) Generated Location: (1457:31,12 [55] )
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>(__value => ParentValue = __value)); builder.AddAttribute(2, "OnChanged", new System.Action<System.Int32>(__value => ParentValue = __value));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (64:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1036:23,12 [50] ) Generated Location: (1207:31,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(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.AddAttribute(2, "OnChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (64:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1018:23,12 [50] ) Generated Location: (1189:31,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>(__value => ParentValue = __value)); builder.AddAttribute(2, "ValueChanged", new System.Action<System.Int32>(__value => ParentValue = __value));
builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue)); builder.AddAttribute(3, "ValueExpression", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue));
builder.CloseComponent(); builder.CloseComponent();

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1236:24,12 [50] ) Generated Location: (1397:32,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -13,7 +13,15 @@ namespace Test
#pragma warning disable 1998 #pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) 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 #pragma warning restore 1998
#nullable restore #nullable restore

View File

@ -2,7 +2,7 @@ Source Location: (58:1,12 [65] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime ParentValue { get; set; } = DateTime.Now; 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; public DateTime ParentValue { get; set; } = DateTime.Now;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>(__value => ParentValue = __value)); builder.AddAttribute(2, "ValueChanged", new System.Action<System.Int32>(__value => ParentValue = __value));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1039:23,12 [50] ) Generated Location: (1200:31,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(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.AddAttribute(2, "ValueChanged", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1021:23,12 [50] ) Generated Location: (1182:31,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.MyComponent>(0); builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(ParentValue))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(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<System.Int32>(__value => ParentValue = __value)); builder.AddAttribute(2, "ValueChanged", new System.Action<System.Int32>(__value => ParentValue = __value));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (54:1,12 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |
Generated Location: (1039:23,12 [55] ) Generated Location: (1200:31,12 [55] )
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenComponent<Test.InputText>(0); builder.OpenComponent<Test.InputText>(0);
builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.String>(Microsoft.AspNetCore.Components.BindMethods.GetValue(person.Name))); builder.AddAttribute(1, "Value", Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.String>(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<System.String>(__value => person.Name = __value)); builder.AddAttribute(2, "ValueChanged", new System.Action<System.String>(__value => person.Name = __value));
builder.CloseComponent(); builder.CloseComponent();
} }

View File

@ -2,7 +2,7 @@ Source Location: (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml)
| |
Person person = new Person(); Person person = new Person();
| |
Generated Location: (1028:23,1 [37] ) Generated Location: (1187:31,1 [37] )
| |
Person person = new Person(); Person person = new Person();
| |

View File

@ -15,7 +15,15 @@ namespace Test
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "type", "text"); 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.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd"));
builder.CloseElement(); builder.CloseElement();
} }

View File

@ -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); 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); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
| |

View File

@ -15,7 +15,15 @@ namespace Test
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");
builder.AddAttribute(1, "type", "text"); 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.AddAttribute(3, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue));
builder.CloseElement(); builder.CloseElement();
} }

View File

@ -2,7 +2,7 @@ Source Location: (70:1,12 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1058:24,12 [50] ) Generated Location: (1235:32,12 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -14,7 +14,15 @@ namespace Test
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "div"); 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.AddAttribute(2, "myevent", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue));
builder.CloseElement(); builder.CloseElement();
} }

Some files were not shown because too many files have changed in this diff Show More