(@namespace.Children[0]);
+ Assert.Equal($"TModel = global::System.Object", usingNode.Content);
+ }
+
+ private RazorCodeDocument CreateDocument(string content)
+ {
+ var source = RazorSourceDocument.Create(content, "test.cshtml");
+ return RazorCodeDocument.Create(source);
+ }
+
+ private ClassDeclarationIntermediateNode FindClassNode(IntermediateNode node)
+ {
+ var visitor = new ClassNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private NamespaceDeclarationIntermediateNode FindNamespaceNode(IntermediateNode node)
+ {
+ var visitor = new NamespaceNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private RazorEngine CreateEngine()
+ {
+ return CreateEngineCore();
+ }
+
+ private RazorEngine CreateDesignTimeEngine()
+ {
+ return CreateEngineCore(designTime: true);
+ }
+
+ private RazorEngine CreateEngineCore(bool designTime = false)
+ {
+ return RazorProjectEngine.Create(b =>
+ {
+ // Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
+ b.AddDirective(ModelDirective.Directive);
+
+ // There's some special interaction with the inherits directive
+ InheritsDirective.Register(b);
+
+ b.Features.Add(new DesignTimeOptionsFeature(designTime));
+ }).Engine;
+ }
+
+ private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < engine.Phases.Count; i++)
+ {
+ var phase = engine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorDocumentClassifierPhase)
+ {
+ break;
+ }
+ }
+
+ // InheritsDirectivePass needs to run before ModelDirective.
+ var pass = new InheritsDirectivePass()
+ {
+ Engine = engine
+ };
+ pass.Execute(codeDocument, codeDocument.GetDocumentIntermediateNode());
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private string GetCSharpContent(IntermediateNode node)
+ {
+ var builder = new StringBuilder();
+ for (var i = 0; i < node.Children.Count; i++)
+ {
+ var child = node.Children[i] as IntermediateToken;
+ if (child.Kind == TokenKind.CSharp)
+ {
+ builder.Append(child.Content);
+ }
+ }
+
+ return builder.ToString();
+ }
+
+ private class ClassNodeVisitor : IntermediateNodeWalker
+ {
+ public ClassDeclarationIntermediateNode Node { get; set; }
+
+ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
+ {
+ Node = node;
+ }
+ }
+
+ private class NamespaceNodeVisitor : IntermediateNodeWalker
+ {
+ public NamespaceDeclarationIntermediateNode Node { get; set; }
+
+ public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node)
+ {
+ Node = node;
+ }
+ }
+
+ private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature
+ {
+ private bool _designTime;
+
+ public DesignTimeOptionsFeature(bool designTime)
+ {
+ _designTime = designTime;
+ }
+
+ public int Order { get; }
+
+ public RazorEngine Engine { get; set; }
+
+ public void Configure(RazorParserOptionsBuilder options)
+ {
+ options.SetDesignTime(_designTime);
+ }
+
+ public void Configure(RazorCodeGenerationOptionsBuilder options)
+ {
+ options.SetDesignTime(_designTime);
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/ModelExpressionPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/ModelExpressionPassTest.cs
new file mode 100644
index 0000000000..d18984c900
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/ModelExpressionPassTest.cs
@@ -0,0 +1,208 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Microsoft.AspNetCore.Razor.Language.Legacy;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class ModelExpressionPassTest
+ {
+ [Fact]
+ public void ModelExpressionPass_NonModelExpressionProperty_Ignored()
+ {
+ // Arrange
+ var codeDocument = CreateDocument(@"
+@addTagHelper TestTagHelper, TestAssembly
+");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly")
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("Foo")
+ .TypeName("System.Int32"))
+ .TagMatchingRuleDescriptor(rule =>
+ rule.RequireTagName("p"))
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ModelExpressionPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var tagHelper = FindTagHelperNode(irDocument);
+ var setProperty = tagHelper.Children.OfType().Single();
+
+ var token = Assert.IsType(Assert.Single(setProperty.Children));
+ Assert.True(token.IsCSharp);
+ Assert.Equal("17", token.Content);
+ }
+
+ [Fact]
+ public void ModelExpressionPass_ModelExpressionProperty_SimpleExpression()
+ {
+ // Arrange
+
+ // Using \r\n here because we verify line mappings
+ var codeDocument = CreateDocument(
+ "@addTagHelper TestTagHelper, TestAssembly\r\n");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly")
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("Foo")
+ .TypeName("Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression"))
+ .TagMatchingRuleDescriptor(rule =>
+ rule.RequireTagName("p"))
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ModelExpressionPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var tagHelper = FindTagHelperNode(irDocument);
+ var setProperty = tagHelper.Children.OfType().Single();
+
+ var expression = Assert.IsType(Assert.Single(setProperty.Children));
+ Assert.Equal("ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Bar)", GetCSharpContent(expression));
+
+ var originalNode = Assert.IsType(expression.Children[2]);
+ Assert.Equal(TokenKind.CSharp, originalNode.Kind);
+ Assert.Equal("Bar", originalNode.Content);
+ Assert.Equal(new SourceSpan("test.cshtml", 51, 1, 8, 3), originalNode.Source.Value);
+ }
+
+ [Fact]
+ public void ModelExpressionPass_ModelExpressionProperty_ComplexExpression()
+ {
+ // Arrange
+
+ // Using \r\n here because we verify line mappings
+ var codeDocument = CreateDocument(
+ "@addTagHelper TestTagHelper, TestAssembly\r\n");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly")
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("Foo")
+ .TypeName("Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression"))
+ .TagMatchingRuleDescriptor(rule =>
+ rule.RequireTagName("p"))
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ModelExpressionPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var tagHelper = FindTagHelperNode(irDocument);
+ var setProperty = tagHelper.Children.OfType().Single();
+
+ var expression = Assert.IsType(Assert.Single(setProperty.Children));
+ Assert.Equal("ModelExpressionProvider.CreateModelExpression(ViewData, __model => Bar)", GetCSharpContent(expression));
+
+ var originalNode = Assert.IsType(expression.Children[1]);
+ Assert.Equal(TokenKind.CSharp, originalNode.Kind);
+ Assert.Equal("Bar", originalNode.Content);
+ Assert.Equal(new SourceSpan("test.cshtml", 52, 1, 9, 3), originalNode.Source.Value);
+ }
+
+ private RazorCodeDocument CreateDocument(string content)
+ {
+ var source = RazorSourceDocument.Create(content, "test.cshtml");
+ return RazorCodeDocument.Create(source);
+ }
+
+ private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
+ {
+ return RazorProjectEngine.Create(b =>
+ {
+ b.Features.Add(new TestTagHelperFeature(tagHelpers));
+ }).Engine;
+ }
+
+ private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < engine.Phases.Count; i++)
+ {
+ var phase = engine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorDirectiveClassifierPhase)
+ {
+ break;
+ }
+ }
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private TagHelperIntermediateNode FindTagHelperNode(IntermediateNode node)
+ {
+ var visitor = new TagHelperNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private string GetCSharpContent(IntermediateNode node)
+ {
+ var builder = new StringBuilder();
+ for (var i = 0; i < node.Children.Count; i++)
+ {
+ var child = node.Children[i] as IntermediateToken;
+ if (child.Kind == TokenKind.CSharp)
+ {
+ builder.Append(child.Content);
+ }
+ }
+
+ return builder.ToString();
+ }
+
+ private class TagHelperNodeVisitor : IntermediateNodeWalker
+ {
+ public TagHelperIntermediateNode Node { get; set; }
+
+ public override void VisitTagHelper(TagHelperIntermediateNode node)
+ {
+ Node = node;
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcImportProjectFeatureTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcImportProjectFeatureTest.cs
new file mode 100644
index 0000000000..13c686adf9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcImportProjectFeatureTest.cs
@@ -0,0 +1,76 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Razor.Language;
+using Moq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class MvcImportProjectFeatureTest
+ {
+ [Fact]
+ public void AddDefaultDirectivesImport_AddsSingleDynamicImport()
+ {
+ // Arrange
+ var imports = new List();
+
+ // Act
+ MvcImportProjectFeature.AddDefaultDirectivesImport(imports);
+
+ // Assert
+ var import = Assert.Single(imports);
+ Assert.Null(import.FilePath);
+ }
+
+ [Fact]
+ public void AddHierarchicalImports_AddsViewImportSourceDocumentsOnDisk()
+ {
+ // Arrange
+ var imports = new List();
+ var projectItem = new TestRazorProjectItem("/Contact/Index.cshtml");
+ var testFileSystem = new TestRazorProjectFileSystem(new[]
+ {
+ new TestRazorProjectItem("/Index.cshtml"),
+ new TestRazorProjectItem("/_ViewImports.cshtml"),
+ new TestRazorProjectItem("/Contact/_ViewImports.cshtml"),
+ projectItem,
+ });
+ var mvcImportFeature = new MvcImportProjectFeature()
+ {
+ ProjectEngine = Mock.Of(projectEngine => projectEngine.FileSystem == testFileSystem)
+ };
+
+ // Act
+ mvcImportFeature.AddHierarchicalImports(projectItem, imports);
+
+ // Assert
+ Assert.Collection(imports,
+ import => Assert.Equal("/_ViewImports.cshtml", import.FilePath),
+ import => Assert.Equal("/Contact/_ViewImports.cshtml", import.FilePath));
+ }
+
+ [Fact]
+ public void AddHierarchicalImports_AddsViewImportSourceDocumentsNotOnDisk()
+ {
+ // Arrange
+ var imports = new List();
+ var projectItem = new TestRazorProjectItem("/Pages/Contact/Index.cshtml");
+ var testFileSystem = new TestRazorProjectFileSystem(new[] { projectItem });
+ var mvcImportFeature = new MvcImportProjectFeature()
+ {
+ ProjectEngine = Mock.Of(projectEngine => projectEngine.FileSystem == testFileSystem)
+ };
+
+ // Act
+ mvcImportFeature.AddHierarchicalImports(projectItem, imports);
+
+ // Assert
+ Assert.Collection(imports,
+ import => Assert.Equal("/_ViewImports.cshtml", import.FilePath),
+ import => Assert.Equal("/Pages/_ViewImports.cshtml", import.FilePath),
+ import => Assert.Equal("/Pages/Contact/_ViewImports.cshtml", import.FilePath));
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcShim.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcShim.cs
new file mode 100644
index 0000000000..acbdea28f3
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcShim.cs
@@ -0,0 +1,45 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.IO;
+using System.Reflection;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ internal static class MvcShim
+ {
+ public static readonly string AssemblyName = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X";
+
+ private static Assembly _assembly;
+ private static CSharpCompilation _baseCompilation;
+
+ public static Assembly Assembly
+ {
+ get
+ {
+ if (_assembly == null)
+ {
+ var filePath = Path.Combine(Directory.GetCurrentDirectory(), AssemblyName + ".dll");
+ _assembly = Assembly.LoadFrom(filePath);
+ }
+
+ return _assembly;
+ }
+ }
+
+ public static CSharpCompilation BaseCompilation
+ {
+ get
+ {
+ if (_baseCompilation == null)
+ {
+ _baseCompilation = TestCompilation.Create(Assembly);
+ }
+
+ return _baseCompilation;
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcViewDocumentClassifierPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcViewDocumentClassifierPassTest.cs
new file mode 100644
index 0000000000..2d437c158d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/MvcViewDocumentClassifierPassTest.cs
@@ -0,0 +1,264 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class MvcViewDocumentClassifierPassTest
+ {
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsDocumentKind()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("mvc.1.0.view", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_NoOpsIfDocumentKindIsAlreadySet()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ irDocument.DocumentKind = "some-value";
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("some-value", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsNamespace()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("AspNetCore", visitor.Namespace.Content);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsClass()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: "Test.cshtml");
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("global::Microsoft.AspNetCore.Mvc.Razor.RazorPage", visitor.Class.BaseType);
+ Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
+ Assert.Equal("Test", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_NullFilePath_SetsClass()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: null, relativePath: null);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("global::Microsoft.AspNetCore.Mvc.Razor.RazorPage", visitor.Class.BaseType);
+ Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
+ Assert.Equal("AspNetCore_d9f877a857a7e9928eac04d09a59f25967624155", visitor.Class.ClassName);
+ }
+
+ [Theory]
+ [InlineData("/Views/Home/Index.cshtml", "_Views_Home_Index")]
+ [InlineData("/Areas/MyArea/Views/Home/About.cshtml", "_Areas_MyArea_Views_Home_About")]
+ public void MvcViewDocumentClassifierPass_UsesRelativePathToGenerateTypeName(string relativePath, string expected)
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: relativePath);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal(expected, visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_UsesAbsolutePath_IfRelativePathIsNotSet()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", properties));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("x___application_Views_Home_Index", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SanitizesClassName()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("path_with_invalid_chars", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsUpExecuteAsyncMethod()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("some-content", "Test.cshtml"));
+
+ var projectEngine = CreateProjectEngine();
+ var irDocument = CreateIRDocument(projectEngine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = projectEngine.Engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("ExecuteAsync", visitor.Method.MethodName);
+ Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType);
+ Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
+ }
+
+ private static RazorProjectEngine CreateProjectEngine() => RazorProjectEngine.Create();
+
+ private static DocumentIntermediateNode CreateIRDocument(RazorProjectEngine projectEngine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < projectEngine.Phases.Count; i++)
+ {
+ var phase = projectEngine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorIntermediateNodeLoweringPhase)
+ {
+ break;
+ }
+ }
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private class Visitor : IntermediateNodeWalker
+ {
+ public NamespaceDeclarationIntermediateNode Namespace { get; private set; }
+
+ public ClassDeclarationIntermediateNode Class { get; private set; }
+
+ public MethodDeclarationIntermediateNode Method { get; private set; }
+
+ public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node)
+ {
+ Method = node;
+ }
+
+ public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node)
+ {
+ Namespace = node;
+ base.VisitNamespaceDeclaration(node);
+ }
+
+ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
+ {
+ Class = node;
+ base.VisitClassDeclaration(node);
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/NamespaceDirectiveTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/NamespaceDirectiveTest.cs
new file mode 100644
index 0000000000..8e5d76c678
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/NamespaceDirectiveTest.cs
@@ -0,0 +1,352 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Moq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class NamespaceDirectiveTest
+ {
+ [Fact]
+ public void GetNamespace_IncompleteDirective_UsesEmptyNamespace()
+ {
+ // Arrange
+ var source = "c:\\foo\\bar\\bleh.cshtml";
+ var imports = "c:\\foo\\baz\\bleh.cshtml";
+ var node = new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(imports, 0, 0, 0, 0),
+ };
+
+ // Act
+ var @namespace = NamespaceDirective.GetNamespace(source, node);
+
+ // Assert
+ Assert.Equal(string.Empty, @namespace);
+ }
+
+ [Fact]
+ public void GetNamespace_EmptyDirective_UsesEmptyNamespace()
+ {
+ // Arrange
+ var source = "c:\\foo\\bar\\bleh.cshtml";
+ var imports = "c:\\foo\\baz\\bleh.cshtml";
+ var node = new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(imports, 0, 0, 0, 0),
+ };
+ node.Children.Add(new DirectiveTokenIntermediateNode() { Content = string.Empty });
+
+ // Act
+ var @namespace = NamespaceDirective.GetNamespace(source, node);
+
+ // Assert
+ Assert.Equal(string.Empty, @namespace);
+ }
+
+ // When we don't have a relationship between the source file and the imports file
+ // we will just use the namespace on the node directly.
+ [Theory]
+ [InlineData((string)null, (string)null)]
+ [InlineData("", "")]
+ [InlineData(null, "/foo/bar")]
+ [InlineData("/foo/baz", "/foo/bar/bleh")]
+ [InlineData("/foo.cshtml", "/foo/bar.cshtml")]
+ [InlineData("c:\\foo.cshtml", "d:\\foo\\bar.cshtml")]
+ [InlineData("c:\\foo\\bar\\bleh.cshtml", "c:\\foo\\baz\\bleh.cshtml")]
+ public void GetNamespace_ForNonRelatedFiles_UsesNamespaceVerbatim(string source, string imports)
+ {
+ // Arrange
+ var node = new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(imports, 0, 0, 0, 0),
+ };
+
+ node.Children.Add(new DirectiveTokenIntermediateNode() { Content = "Base" });
+
+ // Act
+ var @namespace = NamespaceDirective.GetNamespace(source, node);
+
+ // Assert
+ Assert.Equal("Base", @namespace);
+ }
+
+ [Theory]
+ [InlineData("/foo.cshtml", "/_ViewImports.cshtml", "Base")]
+ [InlineData("/foo/bar.cshtml", "/_ViewImports.cshtml", "Base.foo")]
+ [InlineData("/foo/bar/baz.cshtml", "/_ViewImports.cshtml", "Base.foo.bar")]
+ [InlineData("/foo/bar/baz.cshtml", "/foo/_ViewImports.cshtml", "Base.bar")]
+ [InlineData("/Foo/bar/baz.cshtml", "/foo/_ViewImports.cshtml", "Base.bar")]
+ [InlineData("c:\\foo.cshtml", "c:\\_ViewImports.cshtml", "Base")]
+ [InlineData("c:\\foo\\bar.cshtml", "c:\\_ViewImports.cshtml", "Base.foo")]
+ [InlineData("c:\\foo\\bar\\baz.cshtml", "c:\\_ViewImports.cshtml", "Base.foo.bar")]
+ [InlineData("c:\\foo\\bar\\baz.cshtml", "c:\\foo\\_ViewImports.cshtml", "Base.bar")]
+ [InlineData("c:\\Foo\\bar\\baz.cshtml", "c:\\foo\\_ViewImports.cshtml", "Base.bar")]
+ public void GetNamespace_ForRelatedFiles_ComputesNamespaceWithSuffix(string source, string imports, string expected)
+ {
+ // Arrange
+ var node = new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(imports, 0, 0, 0, 0),
+ };
+
+ node.Children.Add(new DirectiveTokenIntermediateNode() { Content = "Base" });
+
+ // Act
+ var @namespace = NamespaceDirective.GetNamespace(source, node);
+
+ // Assert
+ Assert.Equal(expected, @namespace);
+ }
+
+ // This is the case where a _ViewImports sets the namespace.
+ [Fact]
+ public void Pass_SetsNamespace_ComputedFromImports()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+
+ // This is the case where the source file sets the namespace.
+ [Fact]
+ public void Pass_SetsNamespace_ComputedFromSource()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ // This will be ignored.
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" });
+ builder.Pop();
+
+ // This will be used.
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+
+ // Handles cases where invalid characters appears in FileNames. Note that we don't sanitize the part of
+ // the namespace that you put in an import, just the file-based-suffix. Garbage in, garbage out.
+ [Fact]
+ public void Pass_SetsNamespace_SanitizesClassAndNamespace()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage-Info/Add+User.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("WebApplication.Account.Manage_Info", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+
+ // This is the case where the source file sets the namespace.
+ [Fact]
+ public void Pass_SetsNamespace_ComputedFromSource_ForView()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ // This will be ignored.
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/_ViewImports.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "ignored" });
+ builder.Pop();
+
+ // This will be used.
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan("/Account/Manage/AddUser.cshtml", 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account.Manage" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("WebApplication.Account.Manage", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+
+ // This handles an error case where we can't determine the relationship between the
+ // imports and the source.
+ [Fact]
+ public void Pass_SetsNamespace_VerbatimFromImports()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(null, 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("WebApplication.Account", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+
+ [Fact]
+ public void Pass_DoesNothing_ForUnknownDocumentKind()
+ {
+ // Arrange
+ var document = new DocumentIntermediateNode();
+ var builder = IntermediateNodeBuilder.Create(document);
+
+ builder.Push(new DirectiveIntermediateNode()
+ {
+ Directive = NamespaceDirective.Directive,
+ Source = new SourceSpan(null, 0, 0, 0, 0),
+ });
+ builder.Add(new DirectiveTokenIntermediateNode() { Content = "WebApplication.Account" });
+ builder.Pop();
+
+ var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "default" };
+ builder.Push(@namespace);
+
+ var @class = new ClassDeclarationIntermediateNode() { ClassName = "default" };
+ builder.Add(@class);
+
+ document.DocumentKind = null;
+
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("ignored", "/Account/Manage/AddUser.cshtml"));
+
+ var pass = new NamespaceDirective.Pass();
+ pass.Engine = Mock.Of();
+
+ // Act
+ pass.Execute(codeDocument, document);
+
+ // Assert
+ Assert.Equal("default", @namespace.Content);
+ Assert.Equal("default", @class.ClassName);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/PageDirectiveTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/PageDirectiveTest.cs
new file mode 100644
index 0000000000..1bdb156298
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/PageDirectiveTest.cs
@@ -0,0 +1,148 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class PageDirectiveTest
+ {
+ [Fact]
+ public void TryGetPageDirective_ReturnsTrue_IfPageIsMalformed()
+ {
+ // Arrange
+ var content = "@page \"some-route-template\" Invalid";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.True(result);
+ Assert.Equal("some-route-template", pageDirective.RouteTemplate);
+ Assert.NotNull(pageDirective.DirectiveNode);
+ }
+
+ [Fact]
+ public void TryGetPageDirective_ReturnsTrue_IfPageIsImported()
+ {
+ // Arrange
+ var content = "Hello world";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var importDocument = RazorSourceDocument.Create("@page", "imports.cshtml");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument, new[] { importDocument });
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.True(result);
+ Assert.Null(pageDirective.RouteTemplate);
+ }
+
+ [Fact]
+ public void TryGetPageDirective_ReturnsFalse_IfPageDoesNotHaveDirective()
+ {
+ // Arrange
+ var content = "Hello world";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.False(result);
+ Assert.Null(pageDirective);
+ }
+
+ [Fact]
+ public void TryGetPageDirective_ReturnsTrue_IfPageDoesStartWithDirective()
+ {
+ // Arrange
+ var content = "Hello @page";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.True(result);
+ Assert.Null(pageDirective.RouteTemplate);
+ Assert.NotNull(pageDirective.DirectiveNode);
+ }
+
+ [Fact]
+ public void TryGetPageDirective_ReturnsTrue_IfContentHasDirective()
+ {
+ // Arrange
+ var content = "@page";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.True(result);
+ Assert.Null(pageDirective.RouteTemplate);
+ }
+
+ [Fact]
+ public void TryGetPageDirective_ParsesRouteTemplate()
+ {
+ // Arrange
+ var content = "@page \"some-route-template\"";
+ var sourceDocument = RazorSourceDocument.Create(content, "file");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ var result = PageDirective.TryGetPageDirective(irDocument, out var pageDirective);
+
+ // Assert
+ Assert.True(result);
+ Assert.Equal("some-route-template", pageDirective.RouteTemplate);
+ }
+
+ private RazorEngine CreateEngine()
+ {
+ return RazorProjectEngine.Create(b =>
+ {
+ PageDirective.Register(b);
+ }).Engine;
+ }
+
+ private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < engine.Phases.Count; i++)
+ {
+ var phase = engine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorDocumentClassifierPhase)
+ {
+ break;
+ }
+ }
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..3337ebeac2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/Properties/AssemblyInfo.cs
@@ -0,0 +1,6 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/RazorPageDocumentClassifierPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/RazorPageDocumentClassifierPassTest.cs
new file mode 100644
index 0000000000..74acfa0c13
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/RazorPageDocumentClassifierPassTest.cs
@@ -0,0 +1,417 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Extensions;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class RazorPageDocumentClassifierPassTest
+ {
+ [Fact]
+ public void RazorPageDocumentClassifierPass_LogsErrorForImportedPageDirectives()
+ {
+ // Arrange
+ var sourceSpan = new SourceSpan("import.cshtml", 0, 0, 0, 5);
+ var expectedDiagnostic = RazorExtensionsDiagnosticFactory.CreatePageDirective_CannotBeImported(sourceSpan);
+ var importDocument = RazorSourceDocument.Create("@page", "import.cshtml");
+ var sourceDocument = RazorSourceDocument.Create("Hello World
", "main.cshtml");
+ var codeDocument = RazorCodeDocument.Create(sourceDocument, new[] { importDocument });
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var pageDirectives = irDocument.FindDirectiveReferences(PageDirective.Directive);
+ var directive = Assert.Single(pageDirectives);
+ var diagnostic = Assert.Single(directive.Node.Diagnostics);
+ Assert.Equal(expectedDiagnostic, diagnostic);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_LogsErrorIfDirectiveNotAtTopOfFile()
+ {
+ // Arrange
+ var sourceSpan = new SourceSpan(
+ "Test.cshtml",
+ absoluteIndex: 14 + Environment.NewLine.Length * 2,
+ lineIndex: 2,
+ characterIndex: 0,
+ length: 5 + Environment.NewLine.Length);
+
+ var expectedDiagnostic = RazorExtensionsDiagnosticFactory.CreatePageDirective_MustExistAtTheTopOfFile(sourceSpan);
+ var content = @"
+@somethingelse
+@page
+";
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ var pageDirectives = irDocument.FindDirectiveReferences(PageDirective.Directive);
+ var directive = Assert.Single(pageDirectives);
+ var diagnostic = Assert.Single(directive.Node.Diagnostics);
+ Assert.Equal(expectedDiagnostic, diagnostic);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_DoesNotLogErrorIfCommentAndWhitespaceBeforeDirective()
+ {
+ // Arrange
+ var content = @"
+@* some comment *@
+
+@page
+";
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(content, "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ var pageDirectives = irDocument.FindDirectiveReferences(PageDirective.Directive);
+ var directive = Assert.Single(pageDirectives);
+ Assert.Empty(directive.Node.Diagnostics);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_SetsDocumentKind()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("mvc.1.0.razor-page", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_NoOpsIfDocumentKindIsAlreadySet()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ irDocument.DocumentKind = "some-value";
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("some-value", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_NoOpsIfPageDirectiveIsMalformed()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page+1", "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ irDocument.DocumentKind = "some-value";
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("some-value", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_SetsNamespace()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("AspNetCore", visitor.Namespace.Content);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_SetsClass()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: "Test.cshtml");
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("global::Microsoft.AspNetCore.Mvc.RazorPages.Page", visitor.Class.BaseType);
+ Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
+ Assert.Equal("Test", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_NullFilePath_SetsClass()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: null, relativePath: null);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("global::Microsoft.AspNetCore.Mvc.RazorPages.Page", visitor.Class.BaseType);
+ Assert.Equal(new[] { "public" }, visitor.Class.Modifiers);
+ Assert.Equal("AspNetCore_74fbaab062bb228ed1ab09c5ff8d6ed2417320e2", visitor.Class.ClassName);
+ }
+
+ [Theory]
+ [InlineData("/Views/Home/Index.cshtml", "_Views_Home_Index")]
+ [InlineData("/Areas/MyArea/Views/Home/About.cshtml", "_Areas_MyArea_Views_Home_About")]
+ public void RazorPageDocumentClassifierPass_UsesRelativePathToGenerateTypeName(string relativePath, string expected)
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: relativePath);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal(expected, visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_UsesAbsolutePath_IfRelativePathIsNotSet()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: @"x::\application\Views\Home\Index.cshtml", relativePath: null);
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("x___application_Views_Home_Index", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_SanitizesClassName()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: @"x:\Test.cshtml", relativePath: "path.with+invalid-chars");
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("path_with_invalid_chars", visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_SetsUpExecuteAsyncMethod()
+ {
+ // Arrange
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page", "Test.cshtml"));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("ExecuteAsync", visitor.Method.MethodName);
+ Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType);
+ Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
+ }
+
+ [Fact]
+ public void RazorPageDocumentClassifierPass_AddsRouteTemplateMetadata()
+ {
+ // Arrange
+ var properties = new RazorSourceDocumentProperties(filePath: "ignored", relativePath: "Test.cshtml");
+ var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create("@page \"some-route\"", properties));
+
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new RazorPageDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ var attributeNode = Assert.IsType(visitor.ExtensionNode);
+ Assert.Equal("RouteTemplate", attributeNode.Key);
+ Assert.Equal("some-route", attributeNode.Value);
+ }
+
+ private static RazorEngine CreateEngine()
+ {
+ return RazorProjectEngine.Create(b =>
+ {
+ PageDirective.Register(b);
+ }).Engine;
+ }
+
+ private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < engine.Phases.Count; i++)
+ {
+ var phase = engine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorIntermediateNodeLoweringPhase)
+ {
+ break;
+ }
+ }
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private class Visitor : IntermediateNodeWalker
+ {
+ public NamespaceDeclarationIntermediateNode Namespace { get; private set; }
+
+ public ClassDeclarationIntermediateNode Class { get; private set; }
+
+ public MethodDeclarationIntermediateNode Method { get; private set; }
+
+ public ExtensionIntermediateNode ExtensionNode { get; private set; }
+
+ public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node)
+ {
+ Method = node;
+ }
+
+ public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node)
+ {
+ Namespace = node;
+ base.VisitNamespaceDeclaration(node);
+ }
+
+ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
+ {
+ Class = node;
+ base.VisitClassDeclaration(node);
+ }
+
+ public override void VisitExtension(ExtensionIntermediateNode node)
+ {
+ ExtensionNode = node;
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/SourceMappingsSerializer.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/SourceMappingsSerializer.cs
new file mode 100644
index 0000000000..8c63fd7444
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/SourceMappingsSerializer.cs
@@ -0,0 +1,54 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Text;
+using Microsoft.AspNetCore.Razor.Language;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public static class SourceMappingsSerializer
+ {
+ public static string Serialize(RazorCSharpDocument csharpDocument, RazorSourceDocument sourceDocument)
+ {
+ var builder = new StringBuilder();
+ var sourceFilePath = sourceDocument.FilePath;
+ var charBuffer = new char[sourceDocument.Length];
+ sourceDocument.CopyTo(0, charBuffer, 0, sourceDocument.Length);
+ var sourceContent = new string(charBuffer);
+
+ for (var i = 0; i < csharpDocument.SourceMappings.Count; i++)
+ {
+ var sourceMapping = csharpDocument.SourceMappings[i];
+ if (!string.Equals(sourceMapping.OriginalSpan.FilePath, sourceFilePath, StringComparison.Ordinal))
+ {
+ continue;
+ }
+
+ builder.Append("Source Location: ");
+ AppendMappingLocation(builder, sourceMapping.OriginalSpan, sourceContent);
+
+ builder.Append("Generated Location: ");
+ AppendMappingLocation(builder, sourceMapping.GeneratedSpan, csharpDocument.GeneratedCode);
+
+ builder.AppendLine();
+ }
+
+ return builder.ToString();
+ }
+
+ private static void AppendMappingLocation(StringBuilder builder, SourceSpan location, string content)
+ {
+ builder
+ .AppendLine(location.ToString())
+ .Append("|");
+
+ for (var i = 0; i < location.Length; i++)
+ {
+ builder.Append(content[location.AbsoluteIndex + i]);
+ }
+
+ builder.AppendLine("|");
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TagHelperDescriptorExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TagHelperDescriptorExtensionsTest.cs
new file mode 100644
index 0000000000..af0b983b55
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TagHelperDescriptorExtensionsTest.cs
@@ -0,0 +1,82 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.AspNetCore.Razor.Language;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
+{
+ public class TagHelperDescriptorExtensionsTest
+ {
+ [Fact]
+ public void IsViewComponentKind_ReturnsFalse_ForNonVCTHDescriptor()
+ {
+ // Arrange
+ var tagHelper = CreateTagHelperDescriptor();
+
+ // Act
+ var result = tagHelper.IsViewComponentKind();
+
+ // Assert
+ Assert.False(result);
+ }
+
+ [Fact]
+ public void IsViewComponentKind_ReturnsTrue_ForVCTHDescriptor()
+ {
+ // Arrange
+ var tagHelper = CreateViewComponentTagHelperDescriptor();
+
+ // Act
+ var result = tagHelper.IsViewComponentKind();
+
+ // Assert
+ Assert.True(result);
+ }
+
+ [Fact]
+ public void GetViewComponentName_ReturnsNull_ForNonVCTHDescriptor()
+ {
+ //Arrange
+ var tagHelper = CreateTagHelperDescriptor();
+
+ // Act
+ var result = tagHelper.GetViewComponentName();
+
+ // Assert
+ Assert.Null(result);
+ }
+
+ [Fact]
+ public void GetViewComponentName_ReturnsName_ForVCTHDescriptor()
+ {
+ // Arrange
+ var tagHelper = CreateViewComponentTagHelperDescriptor("ViewComponentName");
+
+ // Act
+ var result = tagHelper.GetViewComponentName();
+
+ // Assert
+ Assert.Equal("ViewComponentName", result);
+ }
+
+ private static TagHelperDescriptor CreateTagHelperDescriptor()
+ {
+ var tagHelper = TagHelperDescriptorBuilder.Create("TypeName", "AssemblyName")
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tag-name"))
+ .Build();
+
+ return tagHelper;
+ }
+
+ private static TagHelperDescriptor CreateViewComponentTagHelperDescriptor(string name = "ViewComponentName")
+ {
+ var tagHelper = TagHelperDescriptorBuilder.Create(ViewComponentTagHelperConventions.Kind, "TypeName", "AssemblyName")
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tag-name"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, name)
+ .Build();
+
+ return tagHelper;
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml
new file mode 100644
index 0000000000..a20b20dae8
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml
@@ -0,0 +1,8 @@
+
+ Hello world
+ @string.Format("{0}", "Hello")
+
+@{
+ var cls = "foo";
+}
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs
new file mode 100644
index 0000000000..d39b64c26d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs
@@ -0,0 +1,71 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ __o = this.ToString();
+
+#line default
+#line hidden
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+__o = string.Format("{0}", "Hello");
+
+#line default
+#line hidden
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+
+ var cls = "foo";
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ if(cls != null) {
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ __o = cls;
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ }
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
new file mode 100644
index 0000000000..4074239b9f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
@@ -0,0 +1,64 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (0:0,0 [4] Basic.cshtml)
+ IntermediateToken - (0:0,0 [4] Basic.cshtml) - Html -
+ IntermediateToken - (30:0,30 [23] Basic.cshtml) - Html - \n Hello world\n
+ CSharpExpression - (54:2,5 [29] Basic.cshtml)
+ IntermediateToken - (54:2,5 [29] Basic.cshtml) - CSharp - string.Format("{0}", "Hello")
+ HtmlContent - (83:2,34 [10] Basic.cshtml)
+ IntermediateToken - (83:2,34 [2] Basic.cshtml) - Html - \n
+ IntermediateToken - (85:3,0 [6] Basic.cshtml) - Html -
+ IntermediateToken - (91:3,6 [2] Basic.cshtml) - Html - \n
+ CSharpCode - (95:4,2 [25] Basic.cshtml)
+ IntermediateToken - (95:4,2 [25] Basic.cshtml) - CSharp - \n var cls = "foo";\n
+ HtmlContent - (123:7,0 [2] Basic.cshtml)
+ IntermediateToken - (123:7,0 [2] Basic.cshtml) - Html -
+ IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt
new file mode 100644
index 0000000000..372b49cb6f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt
@@ -0,0 +1,34 @@
+Source Location: (13:0,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|this.ToString()|
+Generated Location: (1030:26,13 [15] )
+|this.ToString()|
+
+Source Location: (54:2,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|string.Format("{0}", "Hello")|
+Generated Location: (1166:31,6 [29] )
+|string.Format("{0}", "Hello")|
+
+Source Location: (95:4,2 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|
+ var cls = "foo";
+|
+Generated Location: (1312:36,2 [25] )
+|
+ var cls = "foo";
+|
+
+Source Location: (134:7,11 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|if(cls != null) { |
+Generated Location: (1460:42,11 [18] )
+|if(cls != null) { |
+
+Source Location: (153:7,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|cls|
+Generated Location: (1622:47,30 [3] )
+|cls|
+
+Source Location: (156:7,33 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+| }|
+Generated Location: (1773:52,33 [2] )
+| }|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs
new file mode 100644
index 0000000000..8e6b1a7bd7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs
@@ -0,0 +1,95 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6d079dd6c39f39d17a2faff14404b37ab7e8b8fc"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"6d079dd6c39f39d17a2faff14404b37ab7e8b8fc", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(0, 4, true);
+ WriteLiteral("\r\n Hello world\r\n ");
+ EndContext();
+ BeginContext(54, 29, false);
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+Write(string.Format("{0}", "Hello"));
+
+#line default
+#line hidden
+ EndContext();
+ BeginContext(83, 10, true);
+ WriteLiteral("\r\n
\r\n");
+ EndContext();
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+
+ var cls = "foo";
+
+#line default
+#line hidden
+ BeginContext(123, 2, true);
+ WriteLiteral(" {
+ PushWriter(__razor_attribute_value_writer);
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ if(cls != null) {
+
+#line default
+#line hidden
+ BeginContext(153, 3, false);
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ Write(cls);
+
+#line default
+#line hidden
+ EndContext();
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ }
+
+#line default
+#line hidden
+ PopWriter();
+ }
+ ), 133, 25, false);
+ EndWriteAttribute();
+ BeginContext(159, 5, true);
+ WriteLiteral(" />\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt
new file mode 100644
index 0000000000..9173f6251b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt
@@ -0,0 +1,76 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(0, 4, true);
+ HtmlContent - (0:0,0 [4] Basic.cshtml)
+ IntermediateToken - (0:0,0 [4] Basic.cshtml) - Html -
+ IntermediateToken - (30:0,30 [19] Basic.cshtml) - Html - \n Hello world\n
+ IntermediateToken - (49:2,0 [4] Basic.cshtml) - Html -
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(54, 29, false);
+ CSharpExpression - (54:2,5 [29] Basic.cshtml)
+ IntermediateToken - (54:2,5 [29] Basic.cshtml) - CSharp - string.Format("{0}", "Hello")
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(83, 10, true);
+ HtmlContent - (83:2,34 [10] Basic.cshtml)
+ IntermediateToken - (83:2,34 [2] Basic.cshtml) - Html - \n
+ IntermediateToken - (85:3,0 [6] Basic.cshtml) - Html -
+ IntermediateToken - (91:3,6 [2] Basic.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode - (95:4,2 [25] Basic.cshtml)
+ IntermediateToken - (95:4,2 [25] Basic.cshtml) - CSharp - \n var cls = "foo";\n
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(123, 2, true);
+ HtmlContent - (123:7,0 [2] Basic.cshtml)
+ IntermediateToken - (123:7,0 [2] Basic.cshtml) - Html -
+ IntermediateToken - (162:7,39 [2] Basic.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml
new file mode 100644
index 0000000000..224242197b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml
@@ -0,0 +1,15 @@
+@* These test files validate that end-to-end, incomplete directives don't throw. *@
+
+@page
+@page
+@page "
+
+@model
+@model
+
+@inject
+@inject
+@inject MyService
+
+@namespace
+@namespace
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
new file mode 100644
index 0000000000..dd100bee00
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
@@ -0,0 +1,71 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml"
+MyService __typeHelper = default(MyService);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ ((System.Action)(() => {
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..1cfef392ae
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt
@@ -0,0 +1,12 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ2001: The 'page' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,1): Error RZ2001: The 'page' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ1016: The 'page' directive expects a string surrounded by double quotes.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,1): Error RZ2001: The 'model' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ1015: The 'inject' directive expects an identifier.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ1014: The 'namespace' directive expects a namespace name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,1): Error RZ2001: The 'namespace' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ1014: The 'namespace' directive expects a namespace name.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
new file mode 100644
index 0000000000..2aeddc2fa2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
@@ -0,0 +1,84 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (119:6,6 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (128:7,7 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (139:9,7 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (149:10,8 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (159:11,8 [17] IncompleteDirectives.cshtml) - MyService
+ DirectiveToken - (176:11,25 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (190:13,10 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (203:14,11 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ MalformedDirective - (94:3,0 [8] IncompleteDirectives.cshtml) - page
+ MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml) - page
+ HtmlContent - (108:4,6 [5] IncompleteDirectives.cshtml)
+ IntermediateToken - (108:4,6 [5] IncompleteDirectives.cshtml) - Html - "\n\n
+ MalformedDirective - (113:6,0 [6] IncompleteDirectives.cshtml) - model
+ DirectiveToken - (119:6,6 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (119:6,6 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (119:6,6 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (121:7,0 [7] IncompleteDirectives.cshtml) - model
+ DirectiveToken - (128:7,7 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (128:7,7 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (128:7,7 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ MalformedDirective - (132:9,0 [7] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (139:9,7 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (139:9,7 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (139:9,7 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (141:10,0 [8] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (149:10,8 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (149:10,8 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (149:10,8 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (151:11,0 [25] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (159:11,8 [17] IncompleteDirectives.cshtml) - MyService
+ DirectiveToken - (176:11,25 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (176:11,25 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (176:11,25 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ MalformedDirective - (180:13,0 [10] IncompleteDirectives.cshtml) - namespace
+ DirectiveToken - (190:13,10 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (190:13,10 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (190:13,10 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (192:14,0 [11] IncompleteDirectives.cshtml) - namespace
+ DirectiveToken - (203:14,11 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (203:14,11 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (203:14,11 [2] IncompleteDirectives.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
new file mode 100644
index 0000000000..4bb61bf781
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
@@ -0,0 +1,40 @@
+Source Location: (119:6,6 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (671:18,0 [0] )
+||
+
+Source Location: (128:7,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (724:21,0 [0] )
+||
+
+Source Location: (139:9,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (777:24,0 [0] )
+||
+
+Source Location: (149:10,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (830:27,0 [0] )
+||
+
+Source Location: (159:11,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+|MyService|
+Generated Location: (980:31,0 [17] )
+|MyService|
+
+Source Location: (176:11,25 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (1133:38,0 [0] )
+||
+
+Source Location: (190:13,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (1186:41,0 [0] )
+||
+
+Source Location: (203:14,11 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (1239:44,0 [0] )
+||
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs
new file mode 100644
index 0000000000..743eed291e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs
@@ -0,0 +1,65 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5add9dba0a182cd75498c5b24f64a2547e7f49b0"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), null)]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"5add9dba0a182cd75498c5b24f64a2547e7f49b0", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(83, 4, true);
+ WriteLiteral("\r\n\r\n");
+ EndContext();
+ BeginContext(108, 5, true);
+ WriteLiteral("\"\r\n\r\n");
+ EndContext();
+ BeginContext(119, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(128, 4, true);
+ WriteLiteral("\r\n\r\n");
+ EndContext();
+ BeginContext(139, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(149, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(176, 4, true);
+ WriteLiteral("\r\n\r\n");
+ EndContext();
+ BeginContext(190, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(203, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..1cfef392ae
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt
@@ -0,0 +1,12 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ2001: The 'page' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,1): Error RZ2001: The 'page' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(5,7): Error RZ1016: The 'page' directive expects a string surrounded by double quotes.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,7): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,1): Error RZ2001: The 'model' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,8): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(10,8): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(11,9): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(12,26): Error RZ1015: The 'inject' directive expects an identifier.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(14,11): Error RZ1014: The 'namespace' directive expects a namespace name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,1): Error RZ2001: The 'namespace' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(15,12): Error RZ1014: The 'namespace' directive expects a namespace name.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt
new file mode 100644
index 0000000000..bd3bdd87e2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt
@@ -0,0 +1,95 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), null)]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(83, 4, true);
+ HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (94:3,0 [8] IncompleteDirectives.cshtml) - page
+ MalformedDirective - (102:4,0 [6] IncompleteDirectives.cshtml) - page
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(108, 5, true);
+ HtmlContent - (108:4,6 [5] IncompleteDirectives.cshtml)
+ IntermediateToken - (108:4,6 [5] IncompleteDirectives.cshtml) - Html - "\n\n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (113:6,0 [6] IncompleteDirectives.cshtml) - model
+ DirectiveToken - (119:6,6 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(119, 2, true);
+ HtmlContent - (119:6,6 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (119:6,6 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (121:7,0 [7] IncompleteDirectives.cshtml) - model
+ DirectiveToken - (128:7,7 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(128, 4, true);
+ HtmlContent - (128:7,7 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (128:7,7 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (132:9,0 [7] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (139:9,7 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(139, 2, true);
+ HtmlContent - (139:9,7 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (139:9,7 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (141:10,0 [8] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (149:10,8 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(149, 2, true);
+ HtmlContent - (149:10,8 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (149:10,8 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (151:11,0 [25] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (159:11,8 [17] IncompleteDirectives.cshtml) - MyService
+ DirectiveToken - (176:11,25 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(176, 4, true);
+ HtmlContent - (176:11,25 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (176:11,25 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (180:13,0 [10] IncompleteDirectives.cshtml) - namespace
+ DirectiveToken - (190:13,10 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(190, 2, true);
+ HtmlContent - (190:13,10 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (190:13,10 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (192:14,0 [11] IncompleteDirectives.cshtml) - namespace
+ DirectiveToken - (203:14,11 [0] IncompleteDirectives.cshtml) -
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(203, 2, true);
+ HtmlContent - (203:14,11 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (203:14,11 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
new file mode 100644
index 0000000000..38efd570da
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
@@ -0,0 +1,2 @@
+@inherits MyBasePageForViews
+@model MyModel
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..7cdbaf3326
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs
@@ -0,0 +1,56 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml"
+MyBasePageForViews __typeHelper = default(MyBasePageForViews);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml"
+MyModel __typeHelper = default(MyModel);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..3310acfa76
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt
@@ -0,0 +1,39 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (10:0,10 [26] InheritsViewModel.cshtml) - MyBasePageForViews
+ DirectiveToken - (45:1,7 [7] InheritsViewModel.cshtml) - MyModel
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..6a313a909d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml)
+|MyBasePageForViews|
+Generated Location: (740:19,0 [26] )
+|MyBasePageForViews|
+
+Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml)
+|MyModel|
+Generated Location: (1004:27,0 [7] )
+|MyModel|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs
new file mode 100644
index 0000000000..9680177b77
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs
@@ -0,0 +1,36 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3ff83e2f0d946feb387a8ea03a529c64350014f8"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"3ff83e2f0d946feb387a8ea03a529c64350014f8", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt
new file mode 100644
index 0000000000..2468ef4662
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt
@@ -0,0 +1,20 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
new file mode 100644
index 0000000000..295e4cf3ab
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
@@ -0,0 +1,2 @@
+@page
+@model MyModel
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs
new file mode 100644
index 0000000000..f174a0fc2f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs
@@ -0,0 +1,50 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml"
+MyModel __typeHelper = default(MyModel);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public MyModel Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt
new file mode 100644
index 0000000000..bcbf42ae26
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt
@@ -0,0 +1,43 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (10:0,10 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) - MyPageModel
+ DirectiveToken - (14:1,7 [7] InheritsWithViewImports.cshtml) - MyModel
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public MyModel Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e7daecd874
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (14:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml)
+|MyModel|
+Generated Location: (745:19,0 [7] )
+|MyModel|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs
new file mode 100644
index 0000000000..c1ea0b5c3e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs
@@ -0,0 +1,39 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d196fc1c66d46d35e35af9b01c737e12bcce6782"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), null)]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"d196fc1c66d46d35e35af9b01c737e12bcce6782", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")]
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"f311ecbb5c4d63980a59c24af5ffe8baa1c3f99a", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public MyModel Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt
new file mode 100644
index 0000000000..2704223a57
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt
@@ -0,0 +1,25 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), null)]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public MyModel Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
new file mode 100644
index 0000000000..0aa749dd3f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
@@ -0,0 +1 @@
+@inject MyApp MyPropertyName
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml
new file mode 100644
index 0000000000..d699f1e754
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml
@@ -0,0 +1,3 @@
+@model MyModel
+@inject MyApp MyPropertyName
+@inject MyService Html
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..2120622373
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs
@@ -0,0 +1,82 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+MyModel __typeHelper = default(MyModel);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+MyApp __typeHelper = default(MyApp);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+global::System.Object MyPropertyName = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+MyService __typeHelper = default(MyService);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+global::System.Object Html = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..c1d70d5d89
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt
@@ -0,0 +1,43 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (7:0,7 [7] InjectWithModel.cshtml) - MyModel
+ DirectiveToken - (24:1,8 [5] InjectWithModel.cshtml) - MyApp
+ DirectiveToken - (30:1,14 [14] InjectWithModel.cshtml) - MyPropertyName
+ DirectiveToken - (54:2,8 [17] InjectWithModel.cshtml) - MyService
+ DirectiveToken - (72:2,26 [4] InjectWithModel.cshtml) - Html
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..c4838ff64d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt
@@ -0,0 +1,25 @@
+Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyModel|
+Generated Location: (766:19,0 [7] )
+|MyModel|
+
+Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyApp|
+Generated Location: (990:27,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyPropertyName|
+Generated Location: (1232:35,22 [14] )
+|MyPropertyName|
+
+Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyService|
+Generated Location: (1438:43,0 [17] )
+|MyService|
+
+Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|Html|
+Generated Location: (1704:51,22 [4] )
+|Html|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs
new file mode 100644
index 0000000000..36974edf08
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs
@@ -0,0 +1,38 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2cafb599699b78d76f0355b6f528050b4720789d"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"2cafb599699b78d76f0355b6f528050b4720789d", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt
new file mode 100644
index 0000000000..d018107ae2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt
@@ -0,0 +1,21 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml
new file mode 100644
index 0000000000..8cd61913e4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml
@@ -0,0 +1,5 @@
+@model MyModel
+@inject MyApp MyPropertyName;
+@inject MyService Html;
+@inject MyApp MyPropertyName2 ;
+@inject MyService Html2 ;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs
new file mode 100644
index 0000000000..ea95a4e7eb
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs
@@ -0,0 +1,118 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyModel __typeHelper = default(MyModel);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyApp __typeHelper = default(MyApp);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+global::System.Object MyPropertyName = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyService __typeHelper = default(MyService);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+global::System.Object Html = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyApp __typeHelper = default(MyApp);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+global::System.Object MyPropertyName2 = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyService __typeHelper = default(MyService);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+global::System.Object Html2 = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt
new file mode 100644
index 0000000000..5c4540f366
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt
@@ -0,0 +1,49 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (7:0,7 [7] InjectWithSemicolon.cshtml) - MyModel
+ DirectiveToken - (24:1,8 [5] InjectWithSemicolon.cshtml) - MyApp
+ DirectiveToken - (30:1,14 [14] InjectWithSemicolon.cshtml) - MyPropertyName
+ DirectiveToken - (58:2,8 [17] InjectWithSemicolon.cshtml) - MyService
+ DirectiveToken - (76:2,26 [4] InjectWithSemicolon.cshtml) - Html
+ DirectiveToken - (93:3,8 [5] InjectWithSemicolon.cshtml) - MyApp
+ DirectiveToken - (99:3,14 [15] InjectWithSemicolon.cshtml) - MyPropertyName2
+ DirectiveToken - (129:4,8 [17] InjectWithSemicolon.cshtml) - MyService
+ DirectiveToken - (147:4,26 [5] InjectWithSemicolon.cshtml) - Html2
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt
new file mode 100644
index 0000000000..6a90f75f3e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt
@@ -0,0 +1,45 @@
+Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyModel|
+Generated Location: (774:19,0 [7] )
+|MyModel|
+
+Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyApp|
+Generated Location: (1002:27,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName|
+Generated Location: (1248:35,22 [14] )
+|MyPropertyName|
+
+Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (1458:43,0 [17] )
+|MyService|
+
+Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html|
+Generated Location: (1728:51,22 [4] )
+|Html|
+
+Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyApp|
+Generated Location: (1928:59,0 [5] )
+|MyApp|
+
+Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName2|
+Generated Location: (2174:67,22 [15] )
+|MyPropertyName2|
+
+Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (2385:75,0 [17] )
+|MyService|
+
+Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html2|
+Generated Location: (2655:83,22 [5] )
+|Html2|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs
new file mode 100644
index 0000000000..b8eb5c371d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs
@@ -0,0 +1,42 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8a53bde02f202036e674a23018e04268a3a844bb"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"8a53bde02f202036e674a23018e04268a3a844bb", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt
new file mode 100644
index 0000000000..898557c170
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt
@@ -0,0 +1,23 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs
new file mode 100644
index 0000000000..7b2f4fedc6
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs
@@ -0,0 +1,58 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml"
+MyApp __typeHelper = default(MyApp);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml"
+global::System.Object MyPropertyName = null;
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt
new file mode 100644
index 0000000000..0b8beeae9b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt
@@ -0,0 +1,40 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (8:0,8 [5] Inject.cshtml) - MyApp
+ DirectiveToken - (14:0,14 [14] Inject.cshtml) - MyPropertyName
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt
new file mode 100644
index 0000000000..10ed356ecf
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml)
+|MyApp|
+Generated Location: (748:19,0 [5] )
+|MyApp|
+
+Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml)
+|MyPropertyName|
+Generated Location: (981:27,22 [14] )
+|MyPropertyName|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs
new file mode 100644
index 0000000000..e3493199a4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs
@@ -0,0 +1,38 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "592a6d8544c71b828d4a3fbf92d398cd3ea72790"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"592a6d8544c71b828d4a3fbf92d398cd3ea72790", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt
new file mode 100644
index 0000000000..e05f9d2df9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt
@@ -0,0 +1,21 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml
new file mode 100644
index 0000000000..6dfb72bc31
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml
@@ -0,0 +1 @@
+@namespace Test.
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs
new file mode 100644
index 0000000000..d99c176c52
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs
@@ -0,0 +1,40 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..90446dc58b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml(1,12): Error RZ1014: The 'namespace' directive expects a namespace name.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt
new file mode 100644
index 0000000000..6f9220aab4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt
@@ -0,0 +1,40 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ MalformedDirective - (0:0,0 [11] InvalidNamespaceAtEOF.cshtml) - namespace
+ HtmlContent - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml)
+ IntermediateToken - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml) - Html - Test.
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs
new file mode 100644
index 0000000000..2accba6951
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs
@@ -0,0 +1,39 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "010d175bb6c3f7fa6f2ae04c1fecb4e3bfbf928b"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"010d175bb6c3f7fa6f2ae04c1fecb4e3bfbf928b", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(11, 5, true);
+ WriteLiteral("Test.");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..90446dc58b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml(1,12): Error RZ1014: The 'namespace' directive expects a namespace name.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt
new file mode 100644
index 0000000000..e99ab2d9c2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt
@@ -0,0 +1,27 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ MalformedDirective - (0:0,0 [11] InvalidNamespaceAtEOF.cshtml) - namespace
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(11, 5, true);
+ HtmlContent - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml)
+ IntermediateToken - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml) - Html - Test.
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml
new file mode 100644
index 0000000000..9b4f9d5559
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml
@@ -0,0 +1,4 @@
+@page "foo
+
+About Us
+We are awesome.
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs
new file mode 100644
index 0000000000..15befce0d0
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs
@@ -0,0 +1,42 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..637d1e902b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml(1,7): Error RZ1016: The 'page' directive expects a string surrounded by double quotes.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt
new file mode 100644
index 0000000000..c3fbc6082e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt
@@ -0,0 +1,51 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page
+ HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml)
+ IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n
+ IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us
+ IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n
+ IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome.
+ IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs
new file mode 100644
index 0000000000..7835a2dae2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs
@@ -0,0 +1,41 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "464e008b9a04181fe1e9f2cc6826095698de4739"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), null)]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"464e008b9a04181fe1e9f2cc6826095698de4739", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(6, 49, true);
+ WriteLiteral("\"foo\r\n\r\nAbout Us
\r\nWe are awesome.
");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..637d1e902b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml(1,7): Error RZ1016: The 'page' directive expects a string surrounded by double quotes.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt
new file mode 100644
index 0000000000..0692442d42
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt
@@ -0,0 +1,38 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), null)]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(6, 49, true);
+ HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml)
+ IntermediateToken - (6:0,6 [8] MalformedPageDirective.cshtml) - Html - "foo\n\n
+ IntermediateToken - (14:2,0 [4] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (18:2,4 [8] MalformedPageDirective.cshtml) - Html - About Us
+ IntermediateToken - (26:2,12 [5] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (31:2,17 [2] MalformedPageDirective.cshtml) - Html - \n
+ IntermediateToken - (33:3,0 [3] MalformedPageDirective.cshtml) - Html -
+ IntermediateToken - (36:3,3 [15] MalformedPageDirective.cshtml) - Html - We are awesome.
+ IntermediateToken - (51:3,18 [4] MalformedPageDirective.cshtml) - Html -
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
new file mode 100644
index 0000000000..4b73b2dc53
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
@@ -0,0 +1 @@
+@model System.Collections.IEnumerable
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml
new file mode 100644
index 0000000000..c488b1e443
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml
@@ -0,0 +1,6 @@
+@model DateTime
+
+@addTagHelper "InputTestTagHelper, AppCode"
+
+
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
new file mode 100644
index 0000000000..82441cd663
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
@@ -0,0 +1,69 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ private global::InputTestTagHelper __InputTestTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+DateTime __typeHelper = default(DateTime);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+global::System.Object __typeHelper = "InputTestTagHelper, AppCode";
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ __InputTestTagHelper = CreateTagHelper();
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Date);
+
+#line default
+#line hidden
+ __InputTestTagHelper = CreateTagHelper();
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => Model);
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt
new file mode 100644
index 0000000000..37627e94ea
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt
@@ -0,0 +1,68 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (7:0,7 [8] ModelExpressionTagHelper.cshtml) - DateTime
+ DirectiveToken - (33:2,14 [29] ModelExpressionTagHelper.cshtml) - "InputTestTagHelper, AppCode"
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (17:1,0 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (17:1,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ HtmlContent - (62:2,43 [4] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (62:2,43 [4] ModelExpressionTagHelper.cshtml) - Html - \n\n
+ TagHelper - (66:4,0 [25] ModelExpressionTagHelper.cshtml) - input-test - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - InputTestTagHelper
+ DefaultTagHelperProperty - (83:4,17 [4] ModelExpressionTagHelper.cshtml) - for - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression InputTestTagHelper.For - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression -
+ IntermediateToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model =>
+ IntermediateToken - - CSharp - __model.
+ IntermediateToken - (83:4,17 [4] ModelExpressionTagHelper.cshtml) - CSharp - Date
+ IntermediateToken - - CSharp - )
+ DefaultTagHelperExecute -
+ HtmlContent - (91:4,25 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (91:4,25 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ TagHelper - (93:5,0 [27] ModelExpressionTagHelper.cshtml) - input-test - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - InputTestTagHelper
+ DefaultTagHelperProperty - (110:5,17 [6] ModelExpressionTagHelper.cshtml) - for - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression InputTestTagHelper.For - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression -
+ IntermediateToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model =>
+ IntermediateToken - (111:5,18 [5] ModelExpressionTagHelper.cshtml) - CSharp - Model
+ IntermediateToken - - CSharp - )
+ DefaultTagHelperExecute -
+ HtmlContent - (120:5,27 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (120:5,27 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt
new file mode 100644
index 0000000000..63a7d6ccc1
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt
@@ -0,0 +1,20 @@
+Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|DateTime|
+Generated Location: (851:20,0 [8] )
+|DateTime|
+
+Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|"InputTestTagHelper, AppCode"|
+Generated Location: (1123:28,37 [29] )
+|"InputTestTagHelper, AppCode"|
+
+Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Date|
+Generated Location: (1802:44,102 [4] )
+|Date|
+
+Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Model|
+Generated Location: (2118:50,94 [5] )
+|Model|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs
new file mode 100644
index 0000000000..799bbc1362
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs
@@ -0,0 +1,107 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "741fc99adb54ad906c5cdc5391aeffb51a1e767b"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"741fc99adb54ad906c5cdc5391aeffb51a1e767b", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #line hidden
+ #pragma warning disable 0169
+ private string __tagHelperStringValueBuffer;
+ #pragma warning restore 0169
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ 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::InputTestTagHelper __InputTestTagHelper;
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(17, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(64, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(66, 25, false);
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => {
+ }
+ );
+ __InputTestTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__InputTestTagHelper);
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Date);
+
+#line default
+#line hidden
+ __tagHelperExecutionContext.AddTagHelperAttribute("for", __InputTestTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ if (!__tagHelperExecutionContext.Output.IsContentModified)
+ {
+ await __tagHelperExecutionContext.SetOutputContentAsync();
+ }
+ Write(__tagHelperExecutionContext.Output);
+ __tagHelperExecutionContext = __tagHelperScopeManager.End();
+ EndContext();
+ BeginContext(91, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(93, 27, false);
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => {
+ }
+ );
+ __InputTestTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__InputTestTagHelper);
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => Model);
+
+#line default
+#line hidden
+ __tagHelperExecutionContext.AddTagHelperAttribute("for", __InputTestTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ if (!__tagHelperExecutionContext.Output.IsContentModified)
+ {
+ await __tagHelperExecutionContext.SetOutputContentAsync();
+ }
+ Write(__tagHelperExecutionContext.Output);
+ __tagHelperExecutionContext = __tagHelperScopeManager.End();
+ EndContext();
+ BeginContext(120, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt
new file mode 100644
index 0000000000..1fb7820a75
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt
@@ -0,0 +1,73 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(17, 2, true);
+ HtmlContent - (17:1,0 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (17:1,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(64, 2, true);
+ HtmlContent - (64:3,0 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (64:3,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(66, 25, false);
+ TagHelper - (66:4,0 [25] ModelExpressionTagHelper.cshtml) - input-test - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - InputTestTagHelper
+ DefaultTagHelperProperty - (83:4,17 [4] ModelExpressionTagHelper.cshtml) - for - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression InputTestTagHelper.For - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression -
+ IntermediateToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model =>
+ IntermediateToken - - CSharp - __model.
+ IntermediateToken - (83:4,17 [4] ModelExpressionTagHelper.cshtml) - CSharp - Date
+ IntermediateToken - - CSharp - )
+ DefaultTagHelperExecute -
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(91, 2, true);
+ HtmlContent - (91:4,25 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (91:4,25 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(93, 27, false);
+ TagHelper - (93:5,0 [27] ModelExpressionTagHelper.cshtml) - input-test - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - InputTestTagHelper
+ DefaultTagHelperProperty - (110:5,17 [6] ModelExpressionTagHelper.cshtml) - for - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression InputTestTagHelper.For - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression -
+ IntermediateToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model =>
+ IntermediateToken - (111:5,18 [5] ModelExpressionTagHelper.cshtml) - CSharp - Model
+ IntermediateToken - - CSharp - )
+ DefaultTagHelperExecute -
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(120, 2, true);
+ HtmlContent - (120:5,27 [2] ModelExpressionTagHelper.cshtml)
+ IntermediateToken - (120:5,27 [2] ModelExpressionTagHelper.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs
new file mode 100644
index 0000000000..63c2a52c6f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs
@@ -0,0 +1,48 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml"
+System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt
new file mode 100644
index 0000000000..1ebdc00df2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt
@@ -0,0 +1,38 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (7:0,7 [30] Model.cshtml) - System.Collections.IEnumerable
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt
new file mode 100644
index 0000000000..7d84cf754d
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (7:0,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml)
+|System.Collections.IEnumerable|
+Generated Location: (769:19,0 [30] )
+|System.Collections.IEnumerable|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs
new file mode 100644
index 0000000000..ae8dc1fe65
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs
@@ -0,0 +1,36 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2c1e88396568d309c236020e59bf2abacfadd612"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model))]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"2c1e88396568d309c236020e59bf2abacfadd612", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt
new file mode 100644
index 0000000000..2b7dcff085
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt
@@ -0,0 +1,20 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model))]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml
new file mode 100644
index 0000000000..350f93b776
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml
@@ -0,0 +1,2 @@
+@model ThisShouldBeGenerated
+@model System.Collections.IEnumerable
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs
new file mode 100644
index 0000000000..e8f705cef7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs
@@ -0,0 +1,56 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml"
+ThisShouldBeGenerated __typeHelper = default(ThisShouldBeGenerated);
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml"
+System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..2fe8233c66
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml(2,1): Error RZ2001: The 'model' directive may only occur once per document.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt
new file mode 100644
index 0000000000..f63a69601b
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt
@@ -0,0 +1,41 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (7:0,7 [21] MultipleModels.cshtml) - ThisShouldBeGenerated
+ DirectiveToken - (37:1,7 [30] MultipleModels.cshtml) - System.Collections.IEnumerable
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ MalformedDirective - (30:1,0 [39] MultipleModels.cshtml) - model
+ DirectiveToken - (37:1,7 [30] MultipleModels.cshtml) - System.Collections.IEnumerable
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt
new file mode 100644
index 0000000000..79d7e257c7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
+|ThisShouldBeGenerated|
+Generated Location: (778:19,0 [21] )
+|ThisShouldBeGenerated|
+
+Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
+|System.Collections.IEnumerable|
+Generated Location: (1029:27,0 [30] )
+|System.Collections.IEnumerable|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml
new file mode 100644
index 0000000000..ecee97de58
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml
@@ -0,0 +1,3 @@
+@page
+@namespace Test.Namespace
+Hi There!
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs
new file mode 100644
index 0000000000..9d7181bfad
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs
@@ -0,0 +1,50 @@
+//
+#pragma warning disable 1591
+namespace Test.Namespace
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml"
+global::System.Object __typeHelper = nameof(Test.Namespace);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt
new file mode 100644
index 0000000000..9238a0a419
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt
@@ -0,0 +1,47 @@
+Document -
+ NamespaceDeclaration - - Test.Namespace
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (18:1,11 [14] PageWithNamespace.cshtml) - Test.Namespace
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml)
+ IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -
+ IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There!
+ IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -
+ IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt
new file mode 100644
index 0000000000..b41240c9c5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (18:1,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml)
+|Test.Namespace|
+Generated Location: (809:19,44 [14] )
+|Test.Namespace|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs
new file mode 100644
index 0000000000..9c1a5b03f5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs
@@ -0,0 +1,41 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1edfb1ba4f5f6c70e2c72f4f23baf4dc0ae14377"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml", typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace), null)]
+namespace Test.Namespace
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"1edfb1ba4f5f6c70e2c72f4f23baf4dc0ae14377", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(34, 20, true);
+ WriteLiteral("Hi There!
\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt
new file mode 100644
index 0000000000..53b89427ee
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt
@@ -0,0 +1,33 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml", typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace), null)]
+ NamespaceDeclaration - - Test.Namespace
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(34, 20, true);
+ HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml)
+ IntermediateToken - (34:2,0 [4] PageWithNamespace.cshtml) - Html -
+ IntermediateToken - (38:2,4 [9] PageWithNamespace.cshtml) - Html - Hi There!
+ IntermediateToken - (47:2,13 [5] PageWithNamespace.cshtml) - Html -
+ IntermediateToken - (52:2,18 [2] PageWithNamespace.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml
new file mode 100644
index 0000000000..5172f8f791
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml
@@ -0,0 +1,2 @@
+Some text here.
+@page
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.cs
new file mode 100644
index 0000000000..ec8a4fd5c9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.cs
@@ -0,0 +1,42 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..393b35646e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml(2,1): Error RZ3906: The '@page' directive must precede all other elements defined in a Razor file.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt
new file mode 100644
index 0000000000..c21d9fc82c
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt
@@ -0,0 +1,46 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml)
+ IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here.
+ IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs
new file mode 100644
index 0000000000..107beef619
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs
@@ -0,0 +1,41 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "40c0ffad85d8fef63edfb5d91a08bd1b3609ba6f"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), null)]
+namespace AspNetCore
+{
+ #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.RazorSourceChecksumAttribute(@"SHA1", @"40c0ffad85d8fef63edfb5d91a08bd1b3609ba6f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(0, 28, true);
+ WriteLiteral("Some text here.
\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..393b35646e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml(2,1): Error RZ3906: The '@page' directive must precede all other elements defined in a Razor file.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt
new file mode 100644
index 0000000000..764b704909
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt
@@ -0,0 +1,33 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), null)]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(0, 28, true);
+ HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml)
+ IntermediateToken - (0:0,0 [5] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (5:0,5 [15] RazorPageWithNoLeadingPageDirective.cshtml) - Html - Some text here.
+ IntermediateToken - (20:0,20 [6] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
+ IntermediateToken - (26:0,26 [2] RazorPageWithNoLeadingPageDirective.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml
new file mode 100644
index 0000000000..2bc617c509
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml
@@ -0,0 +1,40 @@
+@page
+
+@model NewModel
+@addTagHelper "*, AppCode"
+@using Microsoft.AspNetCore.Mvc.RazorPages
+
+@functions {
+ public class NewModel : PageModel
+ {
+ public IActionResult OnPost(Customer customer)
+ {
+ Name = customer.Name;
+ return Redirect("~/customers/inlinepagemodels/");
+ }
+
+ public string Name { get; set; }
+ }
+
+ public class Customer
+ {
+ public string Name { get; set; }
+ }
+}
+
+New Customer
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml
new file mode 100644
index 0000000000..63d5955e72
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml
@@ -0,0 +1,13 @@
+@page "/About"
+
+@model NewModel
+@using Microsoft.AspNetCore.Mvc.RazorPages
+
+@functions {
+ public class NewModel : PageModel
+ {
+ public string Name { get; set; }
+ }
+}
+
+New Customer @Model.Name
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs
new file mode 100644
index 0000000000..8f5d082e6a
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs
@@ -0,0 +1,78 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+#line default
+#line hidden
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("RouteTemplate", "/About")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+global::System.Object __typeHelper = "/About";
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+NewModel __typeHelper = default(NewModel);
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+ __o = Model.Name;
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+
+ public class NewModel : PageModel
+ {
+ public string Name { get; set; }
+ }
+
+#line default
+#line hidden
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public NewModel Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt
new file mode 100644
index 0000000000..c71b835bf9
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt
@@ -0,0 +1,60 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ UsingDirective - (36:3,1 [41] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages
+ RazorCompiledItemMetadataAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ DesignTimeDirective -
+ DirectiveToken - (231:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
+ DirectiveToken - (294:7,71 [4] ) - Html
+ DirectiveToken - (308:8,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper
+ DirectiveToken - (363:8,63 [4] ) - Json
+ DirectiveToken - (377:9,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper
+ DirectiveToken - (431:9,62 [9] ) - Component
+ DirectiveToken - (450:10,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper
+ DirectiveToken - (494:10,52 [3] ) - Url
+ DirectiveToken - (507:11,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider
+ DirectiveToken - (578:11,79 [23] ) - ModelExpressionProvider
+ DirectiveToken - (617:12,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (729:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (832:14,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
+ DirectiveToken - (6:0,6 [8] RazorPagesWithRouteTemplate.cshtml) - "/About"
+ DirectiveToken - (25:2,7 [8] RazorPagesWithRouteTemplate.cshtml) - NewModel
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ HtmlContent - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ HtmlContent - (77:3,42 [4] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (77:3,42 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n
+ HtmlContent - (191:10,1 [21] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (191:10,1 [4] RazorPagesWithRouteTemplate.cshtml) - Html - \n\n
+ IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -
+ IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer
+ CSharpExpression - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) - CSharp - Model.Name
+ HtmlContent - (223:12,28 [7] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (223:12,28 [5] RazorPagesWithRouteTemplate.cshtml) - Html -
+ IntermediateToken - (228:12,33 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ CSharpCode - (93:5,12 [97] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (93:5,12 [97] RazorPagesWithRouteTemplate.cshtml) - CSharp - \n public class NewModel : PageModel\n {\n public string Name { get; set; }\n }\n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public NewModel Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt
new file mode 100644
index 0000000000..cc5e9cad30
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt
@@ -0,0 +1,35 @@
+Source Location: (36:3,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml)
+|using Microsoft.AspNetCore.Mvc.RazorPages|
+Generated Location: (492:14,0 [41] )
+|using Microsoft.AspNetCore.Mvc.RazorPages|
+
+Source Location: (6:0,6 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml)
+|"/About"|
+Generated Location: (1108:25,37 [8] )
+|"/About"|
+
+Source Location: (25:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml)
+|NewModel|
+Generated Location: (1313:33,0 [8] )
+|NewModel|
+
+Source Location: (213:12,18 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml)
+|Model.Name|
+Generated Location: (1841:48,18 [10] )
+|Model.Name|
+
+Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml)
+|
+ public class NewModel : PageModel
+ {
+ public string Name { get; set; }
+ }
+|
+Generated Location: (2049:55,12 [97] )
+|
+ public class NewModel : PageModel
+ {
+ public string Name { get; set; }
+ }
+|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs
new file mode 100644
index 0000000000..bff519edb2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs
@@ -0,0 +1,72 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "547900310554f446d88da593a245719ee9dbb12f"
+//
+#pragma warning disable 1591
+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")]
+[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"/About")]
+namespace AspNetCore
+{
+ #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;
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+#line default
+#line hidden
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("RouteTemplate", "/About")]
+ [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"547900310554f446d88da593a245719ee9dbb12f", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")]
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(16, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(79, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(193, 19, true);
+ WriteLiteral("\r\nNew Customer ");
+ EndContext();
+ BeginContext(213, 10, false);
+#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+ Write(Model.Name);
+
+#line default
+#line hidden
+ EndContext();
+ BeginContext(223, 7, true);
+ WriteLiteral("
\r\n");
+ EndContext();
+ }
+ #pragma warning restore 1998
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml"
+
+ public class NewModel : PageModel
+ {
+ public string Name { get; set; }
+ }
+
+#line default
+#line hidden
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ public NewModel Model => ViewData.Model;
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt
new file mode 100644
index 0000000000..5d54680b90
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt
@@ -0,0 +1,61 @@
+Document -
+ RazorCompiledItemAttribute -
+ CSharpCode -
+ IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"/About")]
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - (1:0,1 [14] ) - System
+ UsingDirective - (16:1,1 [34] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [19] ) - System.Linq
+ UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ UsingDirective - (36:3,1 [43] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages
+ RazorCompiledItemMetadataAttribute -
+ RazorSourceChecksumAttribute -
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(16, 2, true);
+ HtmlContent - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(79, 2, true);
+ HtmlContent - (79:4,0 [2] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (79:4,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(193, 19, true);
+ HtmlContent - (193:11,0 [19] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (193:11,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ IntermediateToken - (195:12,0 [4] RazorPagesWithRouteTemplate.cshtml) - Html -
+ IntermediateToken - (199:12,4 [13] RazorPagesWithRouteTemplate.cshtml) - Html - New Customer
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(213, 10, false);
+ CSharpExpression - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (213:12,18 [10] RazorPagesWithRouteTemplate.cshtml) - CSharp - Model.Name
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(223, 7, true);
+ HtmlContent - (223:12,28 [7] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (223:12,28 [5] RazorPagesWithRouteTemplate.cshtml) - Html -
+ IntermediateToken - (228:12,33 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode - (93:5,12 [97] RazorPagesWithRouteTemplate.cshtml)
+ IntermediateToken - (93:5,12 [97] RazorPagesWithRouteTemplate.cshtml) - CSharp - \n public class NewModel : PageModel\n {\n public string Name { get; set; }\n }\n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData;
+ CSharpCode -
+ IntermediateToken - - CSharp - public NewModel Model => ViewData.Model;
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml
new file mode 100644
index 0000000000..b78cc65ec7
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml
@@ -0,0 +1,36 @@
+@page
+
+@addTagHelper "*, AppCode"
+@using Microsoft.AspNetCore.Mvc.RazorPages
+
+@functions {
+ public IActionResult OnPost(Customer customer)
+ {
+ Name = customer.Name;
+ return Redirect("~/customers/inlinepagemodels/");
+ }
+
+ public string Name { get; set; }
+
+ public class Customer
+ {
+ public string Name { get; set; }
+ }
+}
+
+New Customer
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..aeb2631c46
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs
@@ -0,0 +1,83 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ 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;
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml"
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+#line default
+#line hidden
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ private global::DivTagHelper __DivTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml"
+global::System.Object __typeHelper = "*, AppCode";
+
+#line default
+#line hidden
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ __DivTagHelper = CreateTagHelper();
+#line 25 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml"
+ __o = Name;
+
+#line default
+#line hidden
+ __DivTagHelper = CreateTagHelper();
+ __DivTagHelper = CreateTagHelper();
+ __DivTagHelper = CreateTagHelper();
+ __DivTagHelper = CreateTagHelper();
+ }
+ #pragma warning restore 1998
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml"
+
+ public IActionResult OnPost(Customer customer)
+ {
+ Name = customer.Name;
+ return Redirect("~/customers/inlinepagemodels/");
+ }
+
+ public string Name { get; set; }
+
+ public class Customer
+ {
+ public string Name { get; set; }
+ }
+
+#line default
+#line hidden
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary