diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs
index b98a89d8fde..f4844473c3b 100644
--- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
@@ -32,30 +32,7 @@ public async Task SourceGenerator_RazorFiles_Works()
var driver = await GetDriverAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""
Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
@@ -116,63 +93,7 @@ public async Task SourceGenerator_RazorFiles_DesignTime()
var driver2 = driver.WithUpdatedAnalyzerConfigOptions(options);
var result = RunGenerator(compilation!, ref driver2);
-
- var pageOutput =
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-";
- result.VerifyPageOutput(pageOutput);
-
- result.VerifyHostOutput(
- (@"Pages_Index_razor.rsg.cs", @"//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 219
- private void __RazorDirectiveTokenHelpers__() {
- }
- #pragma warning restore 219
- #pragma warning disable 0414
- private static object __o = null;
- #pragma warning restore 0414
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-"),
- (@"Pages_Index_razor.rsg.html", @"Hello world "));
+ result.VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
@@ -182,9 +103,8 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
options.TestGlobalOptions["build_property.RazorDesignTime"] = "true";
driver2 = driver.WithUpdatedAnalyzerConfigOptions(options);
- result = RunGenerator(compilation!, ref driver2);
- result.VerifyPageOutput(pageOutput);
- result.VerifyHostOutput();
+ result = RunGenerator(compilation!, ref driver2)
+ .VerifyOutputsMatch(result, 2, expectedHost: false);
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
@@ -204,53 +124,7 @@ public async Task SourceGeneratorEvents_RazorFiles_Works()
var driver = await GetDriverAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -288,52 +162,7 @@ public async Task IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAre
var driver = await GetDriverAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(@"
-#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591",
-@"
-#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -363,53 +192,7 @@ public async Task IncrementalCompilation_WhenRazorFileMarkupChanges()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -428,30 +211,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (1,
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""e022c3eac864ad044e9b7d56f4c493ab4eab36da""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 1 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -479,53 +239,7 @@ public async Task IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -587,53 +301,7 @@ public class Person
};
var result = RunGenerator(compilation!, ref driver, expectedDiagnostics)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -679,53 +347,7 @@ public async Task IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded(
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -756,52 +378,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (1,
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""1ea7ff43d3a2eecc5502dd3771378e334a8fb068""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter \r\n"");
- __builder.OpenElement(1, ""h3"");
- __builder.AddContent(2, ""Current count: "");
-#nullable restore
-#line (3,21)-(3,26) 24 ""Pages/Counter.razor""
-__builder.AddContent(3, count);
-
-#line default
-#line hidden
-#nullable disable
- __builder.CloseElement();
- __builder.AddMarkupContent(4, ""\r\n"");
- __builder.AddMarkupContent(5, ""Click me "");
- }
- #pragma warning restore 1998
-#nullable restore
-#line 7 ""Pages/Counter.razor""
-
- private int count;
-
- public void Click() => count++;
-
-#line default
-#line hidden
-#nullable disable
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 1 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -831,53 +408,7 @@ public async Task IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsA
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -910,54 +441,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (1,
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""fb93b97dc0d4885250500697f41ffde70decc444""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter \r\n"");
- __builder.OpenElement(1, ""h3"");
- __builder.AddContent(2, ""Current count: "");
-#nullable restore
-#line (3,21)-(3,26) 24 ""Pages/Counter.razor""
-__builder.AddContent(3, count);
-
-#line default
-#line hidden
-#nullable disable
- __builder.CloseElement();
- __builder.AddMarkupContent(4, ""\r\n"");
- __builder.AddMarkupContent(5, ""Click me "");
- }
- #pragma warning restore 1998
-#nullable restore
-#line 7 ""Pages/Counter.razor""
-
- private int count;
-
- public void Click() => count++;
-
- [Parameter] public int IncrementAmount { get; set; }
-
-#line default
-#line hidden
-#nullable disable
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 1 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -997,62 +481,7 @@ public async Task IncrementalCompilation_RazorFiles_WhenProjectReferencesChange(
// Pages/Index.razor(2,7): error CS0246: The type or namespace name 'SurveyPromptRootNamspace' could not be found (are you missing a using directive or an assembly reference?)
d => Assert.Equal(("SourceFile(Microsoft.NET.Sdk.Razor.SourceGenerators\\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\\Pages_Index_razor.g.cs[473..497))", "CS0246"), (d.Location.ToString(), d.Id)));
- result.VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""4745828f8a0ab77b58022ed5d1095a0242f2a7ee""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
-#nullable restore
-#line 2 ""Pages/Index.razor""
-using SurveyPromptRootNamspace;
-
-#line default
-#line hidden
-#nullable disable
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world \r\n"");
- __builder.OpenElement(1, ""SurveyPrompt"");
- __builder.CloseElement();
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ result.VerifyOutputsMatchBaseline();
var diagnostic = Assert.Single(result.Diagnostics);
Assert.Equal("RZ10012", diagnostic.Id);
@@ -1064,40 +493,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
compilation = compilation!.AddReferences(surveyPromptAssembly);
result = RunGenerator(compilation, ref driver)
- .VerifyOutputsMatch(result, (0,
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""4745828f8a0ab77b58022ed5d1095a0242f2a7ee""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
-#nullable restore
-#line 2 ""Pages/Index.razor""
-using SurveyPromptRootNamspace;
-
-#line default
-#line hidden
-#nullable disable
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world \r\n"");
- __builder.OpenComponent(1);
- __builder.CloseComponent();
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-"
-));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 0 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1157,107 +553,7 @@ public async Task SourceGenerator_CshtmlFiles_Works()
var driver = await GetDriverAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Hello world "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1427,107 +723,7 @@ public async Task SourceGenerator_CshtmlFiles_WhenMarkupChanges()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Hello world "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1546,57 +742,7 @@ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Ra
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (1,
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""525ae8e5f9273913494d7a628b965837c601aed4""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Updated Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 1 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1636,106 +782,7 @@ public class Person
};
var result = RunGenerator(compilation!, ref driver, expectedDiagnostics)
- .VerifyPageOutput(@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Hello world "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1785,108 +832,7 @@ public async Task SourceGenerator_CshtmlFiles_NewTagHelper()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""5d59ecd7b7cf7355d7f60234988be34b81a8b614""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""\r\n"");
- WriteLiteral(""Hello world "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -1949,108 +895,7 @@ public async Task SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""8e83eb537e49cadda4aff01de0bd33aa716fc633""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""\r\n"");
- WriteLiteral(""Malformed h1\r\n}\r\n "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
var diagnostic = Assert.Single(result.Diagnostics);
Assert.Equal("RZ1006", diagnostic.Id);
@@ -2060,57 +905,7 @@ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Ra
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (0,
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""26b4fe0ac8d17fb3e02d5cba709603ceba9ae3ef""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Fixed header "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 0 });
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -2129,107 +924,7 @@ public async Task SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced()
var (driver, additionalTexts) = await GetDriverWithAdditionalTextAsync(project);
var result = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""7f59d2951cc70dc08bc4e89b90bd3c5ba68459b9""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Valid h1 "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Views/Shared/_Layout.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""99939b97abcdd846bd8ea59f7a08dacbe060cb3e""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @""mvc.1.0.view"", @""/Views/Shared/_Layout.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Shared/_Layout.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""Layout "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Equal(2, result.GeneratedSources.Length);
@@ -2242,58 +937,7 @@ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Ra
driver = driver.ReplaceAdditionalText(additionalTexts.First(f => f.Path == updatedText.Path), updatedText);
result = RunGenerator(compilation!, ref driver)
- .VerifyOutputsMatch(result, (0,
-@"#pragma checksum ""Pages/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""d088006c7620c4503e95ef0b4cd1dbc82362bf8b""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @""mvc.1.0.view"", @""/Pages/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Pages/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- WriteLiteral(""\r\n"");
- WriteLiteral(""Malformed h1\r\n}\r\n "");
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- }
-}
-#pragma warning restore 1591
-"));
+ .VerifyOutputsMatch(result, n: 2, diffs: new[] { 0 });
var diagnostic = Assert.Single(result.Diagnostics);
Assert.Equal("RZ1006", diagnostic.Id);
@@ -2329,122 +973,7 @@ public string Invoke(string firstName)
var result = RunGenerator(compilation!, ref driver);
// Assert
- result.VerifyPageOutput(
-@"#pragma checksum ""Views/Home/Index.cshtml"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""209ff2a910aa467bb7942ed3e6cb586652327a44""
-//
-#pragma warning disable 1591
-[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Home_Index), @""mvc.1.0.view"", @""/Views/Home/Index.cshtml"")]
-namespace AspNetCoreGeneratedDocument
-{
- #line hidden
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Rendering;
- using Microsoft.AspNetCore.Mvc.ViewFeatures;
- [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute(""Identifier"", ""/Views/Home/Index.cshtml"")]
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
- #nullable restore
- internal sealed class Views_Home_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
- #nullable disable
- {
- #line hidden
- #pragma warning disable 0649
- private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
- #pragma warning restore 0649
- private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
- #pragma warning disable 0169
- private string __tagHelperStringValueBuffer;
- #pragma warning restore 0169
- private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
- private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
- {
- get
- {
- if (__backed__tagHelperScopeManager == null)
- {
- __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
- }
- return __backed__tagHelperScopeManager;
- }
- }
- private global::AspNetCoreGeneratedDocument.Views_Home_Index.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;
- #pragma warning disable 1998
- public async override global::System.Threading.Tasks.Task ExecuteAsync()
- {
- __tagHelperExecutionContext = __tagHelperScopeManager.Begin(""vc:test"", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, ""209ff2a910aa467bb7942ed3e6cb586652327a442587"", async() => {
- }
- );
- __TestViewComponentTagHelper = CreateTagHelper();
- __tagHelperExecutionContext.Add(__TestViewComponentTagHelper);
- BeginWriteTagHelperAttribute();
- WriteLiteral(""Jan"");
- __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
- __TestViewComponentTagHelper.firstName = __tagHelperStringValueBuffer;
- __tagHelperExecutionContext.AddTagHelperAttribute(""first-name"", __TestViewComponentTagHelper.firstName, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
- await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
- if (!__tagHelperExecutionContext.Output.IsContentModified)
- {
- await __tagHelperExecutionContext.SetOutputContentAsync();
- }
- Write(__tagHelperExecutionContext.Output);
- __tagHelperExecutionContext = __tagHelperScopeManager.End();
- }
- #pragma warning restore 1998
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
- #nullable disable
- #nullable restore
- [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
- #nullable disable
- [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(""vc:test"")]
- public class __Generated__TestViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
- {
- private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __helper = null;
- public __Generated__TestViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
- {
- __helper = helper;
- }
- [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
- public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
- public System.String firstName { get; set; }
- public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext __context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput __output)
- {
- (__helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
- var __helperContent = await __helper.InvokeAsync(""Test"", ProcessInvokeAsyncArgs(__context));
- __output.TagName = null;
- __output.Content.SetHtmlContent(__helperContent);
- }
- private Dictionary ProcessInvokeAsyncArgs(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext __context)
- {
- Dictionary args = new Dictionary();
- if (__context.AllAttributes.ContainsName(""first-name""))
- {
- args[nameof(firstName)] = firstName;
- }
- return args;
- }
- }
- }
-}
-#pragma warning restore 1591
-");
+ result.VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
}
@@ -2462,53 +991,7 @@ public async Task SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSupp
var (driver, additionalTexts, optionsProvider) = await GetDriverWithAdditionalTextAndProviderAsync(project);
var result = RunGenerator(compilation!, ref driver);
- result.VerifyPageOutput(
-@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-",
-@"#pragma checksum ""Pages/Counter.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""0de17e526cd536d59072aa0e924e99111b16b97a""
-//
-#pragma warning disable 1591
-namespace MyApp.Pages
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Counter "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ result.VerifyOutputsMatchBaseline();
// now run the generator with suppression
var suppressedOptions = optionsProvider.Clone();
@@ -2516,8 +999,8 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
driver = driver.WithUpdatedAnalyzerConfigOptions(suppressedOptions);
// results should be empty
- var emptyResult = RunGenerator(compilation!, ref driver)
- .VerifyPageOutput();
+ var emptyResult = RunGenerator(compilation!, ref driver);
+ Assert.Empty(emptyResult.GeneratedSources);
// now unsuppress and re-run
driver = driver.WithUpdatedAnalyzerConfigOptions(optionsProvider);
@@ -2537,30 +1020,8 @@ public async Task SourceGenerator_UppercaseRazor_GeneratesComponent()
var compilation = await project.GetCompilationAsync();
var driver = await GetDriverAsync(project);
- var result = RunGenerator(compilation!, ref driver).VerifyPageOutput(@"
-#pragma checksum ""Component.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
-//
-#pragma warning disable 1591
-namespace MyApp
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Component : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
- }
-}
-#pragma warning restore 1591
-");
+ var result = RunGenerator(compilation!, ref driver)
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
@@ -2614,38 +1075,8 @@ public class X {}
var compilation = await project.GetCompilationAsync();
var driver = await GetDriverAsync(project);
- var result = RunGenerator(compilation!, ref driver).VerifyPageOutput(
-@"#pragma checksum ""Component.Razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""20b14071a74e1fd554d7b3dff6ff41722270ebee""
-//
-#pragma warning disable 1591
-namespace MyApp
-{
- #line hidden
- using global::System;
- using global::System.Collections.Generic;
- using global::System.Linq;
- using global::System.Threading.Tasks;
- using global::Microsoft.AspNetCore.Components;
- public partial class Component : global::Microsoft.AspNetCore.Components.ComponentBase
- {
- #pragma warning disable 1998
- protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
- {
- __builder.AddMarkupContent(0, ""Hello world "");
- }
- #pragma warning restore 1998
-#nullable restore
-#line 4 ""Component.Razor""
-
- public class X {}
-
-#line default
-#line hidden
-#nullable disable
- }
-}
-#pragma warning restore 1591
-");
+ var result = RunGenerator(compilation!, ref driver)
+ .VerifyOutputsMatchBaseline();
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedSources);
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
index 1c4da81ea38..8da08235b1a 100644
--- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs
@@ -15,9 +15,11 @@
using System.Runtime.Loader;
using System.Text;
using System.Threading.Tasks;
+using DiffPlex;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
+using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
@@ -406,56 +408,15 @@ internal static class Extensions
// UTF-8 with BOM
private static readonly Encoding _baselineEncoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: true);
-
- public static GeneratorRunResult VerifyPageOutput(this GeneratorRunResult result, params string[] expectedOutput)
- {
- if (expectedOutput.Length == 1 && string.IsNullOrWhiteSpace(expectedOutput[0]))
- {
- Assert.True(false, GenerateExpectedPageOutput(result));
- }
- else
- {
- Assert.Equal(expectedOutput.Length, result.GeneratedSources.Length);
- for (int i = 0; i < result.GeneratedSources.Length; i++)
- {
- var text = TrimChecksum(result.GeneratedSources[i].SourceText.ToString());
- Assert.Equal(text, TrimChecksum(expectedOutput[i]), ignoreWhiteSpaceDifferences: true);
- }
- }
-
- return result;
- }
-
- public static GeneratorRunResult VerifyHostOutput(this GeneratorRunResult result, params (string hintName, string text)[] expectedOutputs)
- {
- if (expectedOutputs.Length == 1 && string.IsNullOrWhiteSpace(expectedOutputs[0].text))
- {
- Assert.True(false, GenerateExpectedHostOutput(result));
- }
- else
- {
- var hostOutputs = result.GetHostOutputs();
- Assert.Equal(expectedOutputs.Length, hostOutputs.Length);
- for (int i = 0; i < hostOutputs.Length; i++)
- {
- var expectedOutput = expectedOutputs[i];
- var actualOutput = hostOutputs[i];
-
- Assert.Equal(expectedOutput.hintName, actualOutput.Key);
- Assert.Equal(expectedOutput.text, actualOutput.Value, ignoreWhiteSpaceDifferences: true);
- }
- }
-
- return result;
- }
- private static string CreateBaselineDirectory(string testPath, string testName)
+ private static string CreateBaselineDirectory(string testPath, string testName, string? subdir = null)
{
var baselineDirectory = Path.Join(
_testProjectRoot,
"TestFiles",
Path.GetFileNameWithoutExtension(testPath)!,
- testName);
+ testName,
+ subdir);
Directory.CreateDirectory(baselineDirectory);
return baselineDirectory;
}
@@ -468,12 +429,12 @@ public static GeneratorRunResult VerifyOutputsMatchBaseline(this GeneratorRunRes
foreach (var source in result.GeneratedSources)
{
- var baselinePath = Path.Join(baselineDirectory, source.HintName);
- var sourceText = source.SourceText.ToString();
- GenerateOutputBaseline(baselinePath, sourceText);
- var baselineText = File.ReadAllText(baselinePath);
- AssertEx.EqualOrDiff(TrimChecksum(baselineText), TrimChecksum(sourceText));
- Assert.True(touchedFiles.Add(baselinePath));
+ VerifyOutput(baselineDirectory, touchedFiles, source);
+ }
+
+ foreach (var source in result.GetHostOutputs())
+ {
+ VerifyHostOutput(baselineDirectory, touchedFiles, source);
}
DeleteUnusedBaselines(baselineDirectory, touchedFiles);
@@ -515,56 +476,87 @@ private static void DeleteUnusedBaselines(string baselineDirectory, HashSet 0)
- {
- sb.AppendLine(",");
- }
- sb.Append("@\"").Append(result.GeneratedSources[i].SourceText.ToString().Replace("\"", "\"\"")).Append('"');
+ AssertEx.EqualOrDiff(expected.GeneratedSources[i].SourceText.ToString(), actual.GeneratedSources[i].SourceText.ToString(), $"Index {i}");
}
- return sb.ToString();
- }
- private static string GenerateExpectedHostOutput(GeneratorRunResult result)
- {
- StringBuilder sb = new StringBuilder("Generated Host Output:").AppendLine().AppendLine();
- var hostOutputs = result.GetHostOutputs();
- for (int i = 0; i < hostOutputs.Length; i++)
- {
- if (i > 0)
- {
- sb.AppendLine(",");
- }
- sb.Append("(@\"").Append(hostOutputs[i].Key.Replace("\"", "\"\"")).Append("\", ");
- sb.Append("@\"").Append(hostOutputs[i].Value.Replace("\"", "\"\"")).Append("\")");
- }
- return sb.ToString();
+ return actual;
}
- public static GeneratorRunResult VerifyOutputsMatch(this GeneratorRunResult actual, GeneratorRunResult expected, params (int index, string replacement)[] diffs)
+ public static GeneratorRunResult VerifyOutputsMatch(this GeneratorRunResult actual, GeneratorRunResult expected,
+ int n, int[]? diffs = null, int[]? hostDiffs = null, bool expectedHost = true,
+ [CallerFilePath] string testPath = "", [CallerMemberName] string testName = "")
{
- Assert.Equal(actual.GeneratedSources.Length, expected.GeneratedSources.Length);
+ var baselineDirectory = CreateBaselineDirectory(testPath, testName, subdir: n.ToString());
+ var touchedFiles = new HashSet();
+
+ Assert.Equal(expected.GeneratedSources.Length, actual.GeneratedSources.Length);
for (int i = 0; i < actual.GeneratedSources.Length; i++)
{
- var diff = diffs.FirstOrDefault(p => p.index == i).replacement;
- if (diff is null)
+ if (diffs?.Contains(i) != true)
{
- var actualText = actual.GeneratedSources[i].SourceText.ToString();
- Assert.True(expected.GeneratedSources[i].SourceText.ToString() == actualText, $"No diff supplied. But index {i} was:\r\n\r\n{actualText.Replace("\"", "\"\"")}");
+ AssertEx.EqualOrDiff(expected.GeneratedSources[i].SourceText.ToString(), actual.GeneratedSources[i].SourceText.ToString(), $"Index {i}");
}
else
{
- AssertEx.EqualOrDiff(TrimChecksum(diff), TrimChecksum(actual.GeneratedSources[i].SourceText.ToString()));
+ Assert.True(expected.GeneratedSources[i].SourceText.ToString() != actual.GeneratedSources[i].SourceText.ToString(),
+ $"Sources at {i} expected to be different, but they are not");
+ VerifyOutput(baselineDirectory, touchedFiles, actual.GeneratedSources[i]);
+ }
+ }
+
+ var actualHostOutputs = actual.GetHostOutputs();
+ if (!expectedHost)
+ {
+ Assert.Empty(actualHostOutputs);
+ }
+ else
+ {
+ var expectedHostOutputs = expected.GetHostOutputs();
+ Assert.Equal(expectedHostOutputs.Length, actualHostOutputs.Length);
+ for (int i = 0; i < actualHostOutputs.Length; i++)
+ {
+ if (hostDiffs?.Contains(i) != true)
+ {
+ AssertEx.EqualOrDiff(expectedHostOutputs[i].Value, actualHostOutputs[i].Value, $"Host index {i}");
+ }
+ else
+ {
+ Assert.True(expectedHostOutputs[i].Value != actualHostOutputs[i].Value,
+ $"Host outputs at {i} expected to be different, but they are not");
+ VerifyHostOutput(baselineDirectory, touchedFiles, actualHostOutputs[i]);
+ }
}
}
+ DeleteUnusedBaselines(baselineDirectory, touchedFiles);
+
return actual;
}
+ private static void VerifyOutput(string baselineDirectory, HashSet touchedFiles, GeneratedSourceResult source)
+ {
+ var baselinePath = Path.Join(baselineDirectory, source.HintName);
+ var sourceText = source.SourceText.ToString();
+ GenerateOutputBaseline(baselinePath, sourceText);
+ var baselineText = File.ReadAllText(baselinePath);
+ AssertEx.EqualOrDiff(TrimChecksum(baselineText), TrimChecksum(sourceText));
+ Assert.True(touchedFiles.Add(baselinePath));
+ }
+
+ private static void VerifyHostOutput(string baselineDirectory, HashSet touchedFiles, (string Key, string Value) source)
+ {
+ var baselinePath = Path.Join(baselineDirectory, "__host__" + source.Key);
+ GenerateOutputBaseline(baselinePath, source.Value);
+ var baselineText = File.ReadAllText(baselinePath);
+ AssertEx.EqualOrDiff(baselineText, source.Value);
+ Assert.True(touchedFiles.Add(baselinePath));
+ }
+
private static string TrimChecksum(string text)
{
var trimmed = text.Trim('\r', '\n') // start and end
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_DoesNotReexecuteSteps_WhenRazorFilesAreUnchanged/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenCSharpTypeChanges/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/2/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/2/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..52995ce4c09
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/2/Pages_Counter_razor.g.cs
@@ -0,0 +1,44 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1ea7ff43d3a2eecc5502dd3771378e334a8fb068"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter \r\n");
+ __builder.OpenElement(1, "h3");
+ __builder.AddContent(2, "Current count: ");
+#nullable restore
+#line (3,21)-(3,26) 24 "Pages/Counter.razor"
+__builder.AddContent(3, count);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+ __builder.AddMarkupContent(4, "\r\n");
+ __builder.AddMarkupContent(5, "Click me ");
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 7 "Pages/Counter.razor"
+
+ private int count;
+
+ public void Click() => count++;
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenChildComponentsAreAdded/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/2/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/2/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..dae3908191d
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/2/Pages_Counter_razor.g.cs
@@ -0,0 +1,46 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "fb93b97dc0d4885250500697f41ffde70decc444"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter \r\n");
+ __builder.OpenElement(1, "h3");
+ __builder.AddContent(2, "Current count: ");
+#nullable restore
+#line (3,21)-(3,26) 24 "Pages/Counter.razor"
+__builder.AddContent(3, count);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+ __builder.AddMarkupContent(4, "\r\n");
+ __builder.AddMarkupContent(5, "Click me ");
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 7 "Pages/Counter.razor"
+
+ private int count;
+
+ public void Click() => count++;
+
+ [Parameter] public int IncrementAmount { get; set; }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewComponentParameterIsAdded/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenNewTypeIsAdded/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/2/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/2/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..aa01ff89774
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/2/Pages_Index_razor.g.cs
@@ -0,0 +1,31 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4745828f8a0ab77b58022ed5d1095a0242f2a7ee"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+#nullable restore
+#line 2 "Pages/Index.razor"
+using SurveyPromptRootNamspace;
+
+#line default
+#line hidden
+#nullable disable
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world \r\n");
+ __builder.OpenComponent(1);
+ __builder.CloseComponent();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..6ad3c3daa62
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_RazorFiles_WhenProjectReferencesChange/Pages_Index_razor.g.cs
@@ -0,0 +1,31 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4745828f8a0ab77b58022ed5d1095a0242f2a7ee"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+#nullable restore
+#line 2 "Pages/Index.razor"
+using SurveyPromptRootNamspace;
+
+#line default
+#line hidden
+#nullable disable
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world \r\n");
+ __builder.OpenElement(1, "SurveyPrompt");
+ __builder.CloseElement();
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/2/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/2/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..82a1253fb22
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/2/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e022c3eac864ad044e9b7d56f4c493ab4eab36da"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/IncrementalCompilation_WhenRazorFileMarkupChanges/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGeneratorEvents_RazorFiles_Works/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_Class_Inside_CodeBlock/Component_Razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_Class_Inside_CodeBlock/Component_Razor.g.cs
new file mode 100644
index 00000000000..a2e4007cdf7
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_Class_Inside_CodeBlock/Component_Razor.g.cs
@@ -0,0 +1,30 @@
+#pragma checksum "Component.Razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "20b14071a74e1fd554d7b3dff6ff41722270ebee"
+//
+#pragma warning disable 1591
+namespace MyApp
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Component : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 4 "Component.Razor"
+
+ public class X {}
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..964f6b2f307
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Pages_Index_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Hello world ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_CSharpTypeChanges/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..7691f369c66
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Pages_Index_cshtml.g.cs
@@ -0,0 +1,50 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5d59ecd7b7cf7355d7f60234988be34b81a8b614"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("\r\n");
+ WriteLiteral("Hello world ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_NewTagHelper/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/2/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/2/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..84c67d029ee
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/2/Pages_Index_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "26b4fe0ac8d17fb3e02d5cba709603ceba9ae3ef"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Fixed header ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..290d7e725c3
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Pages_Index_cshtml.g.cs
@@ -0,0 +1,50 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8e83eb537e49cadda4aff01de0bd33aa716fc633"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("\r\n");
+ WriteLiteral("Malformed h1\r\n}\r\n ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Fixed/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/2/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/2/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..fbc8aa7ce33
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/2/Pages_Index_cshtml.g.cs
@@ -0,0 +1,50 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d088006c7620c4503e95ef0b4cd1dbc82362bf8b"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("\r\n");
+ WriteLiteral("Malformed h1\r\n}\r\n ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..2615294deb7
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Pages_Index_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "7f59d2951cc70dc08bc4e89b90bd3c5ba68459b9"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Valid h1 ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_RazorDiagnostics_Introduced/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_ViewComponentTagHelper/Views_Home_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_ViewComponentTagHelper/Views_Home_Index_cshtml.g.cs
new file mode 100644
index 00000000000..e8ddc5c391b
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_ViewComponentTagHelper/Views_Home_Index_cshtml.g.cs
@@ -0,0 +1,114 @@
+#pragma checksum "Views/Home/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "209ff2a910aa467bb7942ed3e6cb586652327a44"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Home_Index), @"mvc.1.0.view", @"/Views/Home/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Home/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Home_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #line hidden
+ #pragma warning disable 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ #pragma warning restore 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ #pragma warning disable 0169
+ private string __tagHelperStringValueBuffer;
+ #pragma warning restore 0169
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
+ {
+ get
+ {
+ if (__backed__tagHelperScopeManager == null)
+ {
+ __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
+ }
+ return __backed__tagHelperScopeManager;
+ }
+ }
+ private global::AspNetCoreGeneratedDocument.Views_Home_Index.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "209ff2a910aa467bb7942ed3e6cb586652327a442587", async() => {
+ }
+ );
+ __TestViewComponentTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__TestViewComponentTagHelper);
+ BeginWriteTagHelperAttribute();
+ WriteLiteral("Jan");
+ __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
+ __TestViewComponentTagHelper.firstName = __tagHelperStringValueBuffer;
+ __tagHelperExecutionContext.AddTagHelperAttribute("first-name", __TestViewComponentTagHelper.firstName, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ if (!__tagHelperExecutionContext.Output.IsContentModified)
+ {
+ await __tagHelperExecutionContext.SetOutputContentAsync();
+ }
+ Write(__tagHelperExecutionContext.Output);
+ __tagHelperExecutionContext = __tagHelperScopeManager.End();
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("vc:test")]
+ public class __Generated__TestViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
+ {
+ private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __helper = null;
+ public __Generated__TestViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
+ {
+ __helper = helper;
+ }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
+ public System.String firstName { get; set; }
+ public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext __context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput __output)
+ {
+ (__helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
+ var __helperContent = await __helper.InvokeAsync("Test", ProcessInvokeAsyncArgs(__context));
+ __output.TagName = null;
+ __output.Content.SetHtmlContent(__helperContent);
+ }
+ private Dictionary ProcessInvokeAsyncArgs(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext __context)
+ {
+ Dictionary args = new Dictionary();
+ if (__context.AllAttributes.ContainsName("first-name"))
+ {
+ args[nameof(firstName)] = firstName;
+ }
+ return args;
+ }
+ }
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/2/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/2/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..15b7f70ac09
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/2/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "525ae8e5f9273913494d7a628b965837c601aed4"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Updated Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..964f6b2f307
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Pages_Index_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Hello world ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_WhenMarkupChanges/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Pages_Index_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Pages_Index_cshtml.g.cs
new file mode 100644
index 00000000000..964f6b2f307
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Pages_Index_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Pages/Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Pages_Index), @"mvc.1.0.view", @"/Pages/Index.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Pages/Index.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Pages_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Hello world ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Views_Shared__Layout_cshtml.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Views_Shared__Layout_cshtml.g.cs
new file mode 100644
index 00000000000..3a96a8e3791
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_CshtmlFiles_Works/Views_Shared__Layout_cshtml.g.cs
@@ -0,0 +1,49 @@
+#pragma checksum "Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99939b97abcdd846bd8ea59f7a08dacbe060cb3e"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
+namespace AspNetCoreGeneratedDocument
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/Views/Shared/_Layout.cshtml")]
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute]
+ #nullable restore
+ internal sealed class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ #nullable disable
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ WriteLiteral("Layout ");
+ }
+ #pragma warning restore 1998
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } = default!;
+ #nullable disable
+ #nullable restore
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } = default!;
+ #nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Counter_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Counter_razor.g.cs
new file mode 100644
index 00000000000..63284d796b2
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Counter_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Counter.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0de17e526cd536d59072aa0e924e99111b16b97a"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Counter : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Counter ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSuppressed/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.cs
new file mode 100644
index 00000000000..4ef4c86964f
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.cs
@@ -0,0 +1,27 @@
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.html b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.html
new file mode 100644
index 00000000000..acb37ae17d9
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_DesignTime/__host__Pages_Index_razor.rsg.html
@@ -0,0 +1 @@
+Hello world
\ No newline at end of file
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_Works/Pages_Index_razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_Works/Pages_Index_razor.g.cs
new file mode 100644
index 00000000000..281697a8053
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_RazorFiles_Works/Pages_Index_razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Pages/Index.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp.Pages
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_UppercaseRazor_GeneratesComponent/Component_Razor.g.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_UppercaseRazor_GeneratesComponent/Component_Razor.g.cs
new file mode 100644
index 00000000000..ffad93392e7
--- /dev/null
+++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorTests/SourceGenerator_UppercaseRazor_GeneratesComponent/Component_Razor.g.cs
@@ -0,0 +1,22 @@
+#pragma checksum "Component.Razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6b5db227a6aa2228c777b0771108b184b1fc5df3"
+//
+#pragma warning disable 1591
+namespace MyApp
+{
+ #line hidden
+ using global::System;
+ using global::System.Collections.Generic;
+ using global::System.Linq;
+ using global::System.Threading.Tasks;
+ using global::Microsoft.AspNetCore.Components;
+ public partial class Component : global::Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Hello world ");
+ }
+ #pragma warning restore 1998
+ }
+}
+#pragma warning restore 1591