(@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 CreateRuntimeEngine()
+ {
+ return CreateEngineCore();
+ }
+
+ private RazorEngine CreateDesignTimeEngine()
+ {
+ return CreateEngineCore(designTime: true);
+ }
+
+ private RazorEngine CreateEngineCore(bool designTime = false)
+ {
+ return CreateProjectEngine(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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs
new file mode 100644
index 0000000000..30f27ffcbb
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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.Version1_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;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcImportProjectFeatureTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcImportProjectFeatureTest.cs
new file mode 100644
index 0000000000..e53046ed5a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcShim.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcShim.cs
new file mode 100644
index 0000000000..a50560e593
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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
+{
+ internal static class MvcShim
+ {
+ public static readonly string AssemblyName = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcViewDocumentClassifierPassTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/MvcViewDocumentClassifierPassTest.cs
new file mode 100644
index 0000000000..a0a3825267
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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.Version1_X
+{
+ public class MvcViewDocumentClassifierPassTest : RazorProjectEngineTestBase
+ {
+ protected override RazorLanguageVersion Version => RazorLanguageVersion.Version_1_1;
+
+ [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 DocumentIntermediateNode CreateIRDocument(RazorProjectEngine 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 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/Properties/AssemblyInfo.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..3337ebeac2
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/SourceMappingsSerializer.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/SourceMappingsSerializer.cs
new file mode 100644
index 0000000000..c081118d86
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TagHelperDescriptorExtensionsTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TagHelperDescriptorExtensionsTest.cs
new file mode 100644
index 0000000000..f080719b5a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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.Version1_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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml
new file mode 100644
index 0000000000..a20b20dae8
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml
@@ -0,0 +1,8 @@
+
+ Hello world
+ @string.Format("{0}", "Hello")
+
+@{
+ var cls = "foo";
+}
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs
new file mode 100644
index 0000000000..d39b64c26d
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
new file mode 100644
index 0000000000..eb3470593e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
@@ -0,0 +1,63 @@
+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
+ 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt
new file mode 100644
index 0000000000..372b49cb6f
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs
new file mode 100644
index 0000000000..b8ce28e05f
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs
@@ -0,0 +1,92 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4120ddad9d4353ed260e0585fe71080d78ff8ab3"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt
new file mode 100644
index 0000000000..8fedd92ede
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt
@@ -0,0 +1,72 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml
new file mode 100644
index 0000000000..ecc90de2d6
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml
@@ -0,0 +1,8 @@
+@* These test files validate that end-to-end, incomplete directives don't throw. *@
+
+@model
+@model
+
+@inject
+@inject
+@inject MyService
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
new file mode 100644
index 0000000000..de980049d7
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
@@ -0,0 +1,64 @@
+//
+#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.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml"
+
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml"
+
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml"
+MyService __typeHelper = default;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..3542c13c86
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt
@@ -0,0 +1,6 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ2001: The 'model' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ1013: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ1013: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ1015: The 'inject' directive expects an identifier.
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
new file mode 100644
index 0000000000..304921a812
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
@@ -0,0 +1,58 @@
+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.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 - (102:3,7 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (123:6,8 [0] IncompleteDirectives.cshtml) -
+ DirectiveToken - (133:7,8 [17] IncompleteDirectives.cshtml) - MyService
+ 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 - (85:1,0 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (87:2,0 [6] IncompleteDirectives.cshtml) - model
+ HtmlContent - (93:2,6 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (95:3,0 [7] IncompleteDirectives.cshtml) - model
+ DirectiveToken - (102:3,7 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (102:3,7 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ MalformedDirective - (106:5,0 [7] IncompleteDirectives.cshtml) - inject
+ HtmlContent - (113:5,7 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (115:6,0 [8] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (123:6,8 [0] IncompleteDirectives.cshtml) -
+ HtmlContent - (123:6,8 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n
+ MalformedDirective - (125:7,0 [25] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (133:7,8 [17] IncompleteDirectives.cshtml) - MyService
+ HtmlContent - (150:7,25 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
new file mode 100644
index 0000000000..a978e8d898
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
@@ -0,0 +1,15 @@
+Source Location: (102:3,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (776:19,0 [0] )
+||
+
+Source Location: (123:6,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+||
+Generated Location: (966:27,0 [0] )
+||
+
+Source Location: (133:7,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+|MyService|
+Generated Location: (1156:35,0 [17] )
+|MyService|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs
new file mode 100644
index 0000000000..e9170ae11c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs
@@ -0,0 +1,51 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "844eb91b909a14b78feddd5e6866563b5a75e021"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(83, 4, true);
+ WriteLiteral("\r\n\r\n");
+ EndContext();
+ BeginContext(93, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(102, 4, true);
+ WriteLiteral("\r\n\r\n");
+ EndContext();
+ BeginContext(113, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(123, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(150, 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..72a8fa589b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt
@@ -0,0 +1,6 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ9999: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ9999: The 'model' directive may only occur once per document.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ9999: The 'model' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ9999: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ9999: The 'inject' directive expects a type name.
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ9999: The 'inject' directive expects an identifier.
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt
new file mode 100644
index 0000000000..8bb3264f43
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt
@@ -0,0 +1,58 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ 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 - (87:2,0 [6] IncompleteDirectives.cshtml) - model
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(93, 2, true);
+ HtmlContent - (93:2,6 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (95:3,0 [7] IncompleteDirectives.cshtml) - model
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(102, 4, true);
+ HtmlContent - (102:3,7 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (106:5,0 [7] IncompleteDirectives.cshtml) - inject
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(113, 2, true);
+ HtmlContent - (113:5,7 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (115:6,0 [8] IncompleteDirectives.cshtml) - inject
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(123, 2, true);
+ HtmlContent - (123:6,8 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ MalformedDirective - (125:7,0 [25] IncompleteDirectives.cshtml) - inject
+ DirectiveToken - (133:7,8 [17] IncompleteDirectives.cshtml) - MyService
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(150, 2, true);
+ HtmlContent - (150:7,25 [2] IncompleteDirectives.cshtml)
+ IntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
new file mode 100644
index 0000000000..38efd570da
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
@@ -0,0 +1,2 @@
+@inherits MyBasePageForViews
+@model MyModel
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..c5e699c2cf
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml"
+MyModel __typeHelper = default;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..cc189604db
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt
@@ -0,0 +1,37 @@
+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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..b5fd5c933d
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (976:27,0 [7] )
+|MyModel|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs
new file mode 100644
index 0000000000..af9db74379
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs
@@ -0,0 +1,33 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "91cf923452a86b2906083cb0236d6d5b3bc528ef"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt
new file mode 100644
index 0000000000..b18e254c9f
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt
@@ -0,0 +1,16 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel_cshtml - MyBasePageForViews -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
new file mode 100644
index 0000000000..c735e2e429
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
@@ -0,0 +1 @@
+@model MyModel
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs
new file mode 100644
index 0000000000..c8e66ffaaf
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_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_InheritsWithViewImports : MyBasePageForViews
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml"
+MyModel __typeHelper = default;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt
new file mode 100644
index 0000000000..db2a73f64d
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt
@@ -0,0 +1,37 @@
+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 - 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 - (10:0,10 [26] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) - MyBasePageForViews
+ DirectiveToken - (7:0,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 -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt
new file mode 100644
index 0000000000..9ee5bceaa0
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml)
+|MyModel|
+Generated Location: (752:19,0 [7] )
+|MyModel|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs
new file mode 100644
index 0000000000..5ede728cf8
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs
@@ -0,0 +1,33 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "cf2e52e7d1326775fe4ece983a7f8ee1f62235a0"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt
new file mode 100644
index 0000000000..0f47fce86b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt
@@ -0,0 +1,16 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports_cshtml - MyBasePageForViews -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
new file mode 100644
index 0000000000..0aa749dd3f
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
@@ -0,0 +1 @@
+@inject MyApp MyPropertyName
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml
new file mode 100644
index 0000000000..d699f1e754
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml
@@ -0,0 +1,3 @@
+@model MyModel
+@inject MyApp MyPropertyName
+@inject MyService Html
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..4d4d684cda
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml"
+MyApp __typeHelper = default;
+
+#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;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..8ff03ba4e9
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_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_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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..dd6970fdb8
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (981:27,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyPropertyName|
+Generated Location: (1216:35,22 [14] )
+|MyPropertyName|
+
+Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyService|
+Generated Location: (1422:43,0 [17] )
+|MyService|
+
+Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|Html|
+Generated Location: (1669:51,22 [4] )
+|Html|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs
new file mode 100644
index 0000000000..c3846121e1
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs
@@ -0,0 +1,35 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a039b7091118c718dc3023b6ac58d9645cb58e59"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt
new file mode 100644
index 0000000000..2e1c3deb3e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt
@@ -0,0 +1,17 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml
new file mode 100644
index 0000000000..8cd61913e4
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs
new file mode 100644
index 0000000000..15e13c4def
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml"
+MyApp __typeHelper = default;
+
+#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;
+
+#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;
+
+#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;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt
new file mode 100644
index 0000000000..2b470e7180
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt
@@ -0,0 +1,47 @@
+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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt
new file mode 100644
index 0000000000..8c1b0b9336
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (993:27,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName|
+Generated Location: (1232:35,22 [14] )
+|MyPropertyName|
+
+Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (1442:43,0 [17] )
+|MyService|
+
+Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html|
+Generated Location: (1693:51,22 [4] )
+|Html|
+
+Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyApp|
+Generated Location: (1893:59,0 [5] )
+|MyApp|
+
+Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName2|
+Generated Location: (2132:67,22 [15] )
+|MyPropertyName2|
+
+Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (2343:75,0 [17] )
+|MyService|
+
+Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html2|
+Generated Location: (2594:83,22 [5] )
+|Html2|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs
new file mode 100644
index 0000000000..4dd7659e08
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs
@@ -0,0 +1,39 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5010aab35d235175dab517f8018e41aee9a2ac7f"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt
new file mode 100644
index 0000000000..b624d6b15c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt
@@ -0,0 +1,19 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs
new file mode 100644
index 0000000000..ec04e2bf8b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt
new file mode 100644
index 0000000000..2fed4fbe5a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_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_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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt
new file mode 100644
index 0000000000..27b118c2ae
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (974:27,22 [14] )
+|MyPropertyName|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs
new file mode 100644
index 0000000000..941237e909
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs
@@ -0,0 +1,35 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c711078454f5b0e8d2cb77d9cb7fa88cca32b884"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt
new file mode 100644
index 0000000000..32a3c51ac7
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt
@@ -0,0 +1,17 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml
new file mode 100644
index 0000000000..6dfb72bc31
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml
@@ -0,0 +1 @@
+@namespace Test.
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs
new file mode 100644
index 0000000000..d99c176c52
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..c3add1daa9
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml(1,2): Error RZ1007: "namespace" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt
new file mode 100644
index 0000000000..f34fe8f4a0
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt
@@ -0,0 +1,37 @@
+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
+ 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 - (10:0,10 [6] InvalidNamespaceAtEOF.cshtml)
+ IntermediateToken - (10:0,10 [6] InvalidNamespaceAtEOF.cshtml) - Html - Test.
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs
new file mode 100644
index 0000000000..d292eeebcc
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs
@@ -0,0 +1,36 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "de132bd3e2a46a0d2ec953a168427c01e5829cde"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ BeginContext(10, 6, 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt
new file mode 100644
index 0000000000..cfbf688e18
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt
@@ -0,0 +1 @@
+TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml(1,2): Error RZ9999: "namespace" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt
new file mode 100644
index 0000000000..fb0bab7833
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt
@@ -0,0 +1,22 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(10, 6, true);
+ HtmlContent - (10:0,10 [6] InvalidNamespaceAtEOF.cshtml)
+ IntermediateToken - (10:0,10 [6] InvalidNamespaceAtEOF.cshtml) - Html - Test.
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
new file mode 100644
index 0000000000..4b73b2dc53
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
@@ -0,0 +1 @@
+@model System.Collections.IEnumerable
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml
new file mode 100644
index 0000000000..c488b1e443
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml
@@ -0,0 +1,6 @@
+@model DateTime
+
+@addTagHelper "InputTestTagHelper, AppCode"
+
+
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
new file mode 100644
index 0000000000..f0fe1ad8e2
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
@@ -0,0 +1,76 @@
+//
+#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
+ {
+ #line hidden
+ #pragma warning disable 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ #pragma warning restore 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ private global::InputTestTagHelper __InputTestTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+DateTime __typeHelper = default;
+
+#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
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ __InputTestTagHelper = CreateTagHelper();
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => Model);
+
+#line default
+#line hidden
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ }
+ #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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt
new file mode 100644
index 0000000000..1ecd121c63
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt
@@ -0,0 +1,66 @@
+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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt
new file mode 100644
index 0000000000..d4fc8a447a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (1259:25,0 [8] )
+|DateTime|
+
+Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|"InputTestTagHelper, AppCode"|
+Generated Location: (1521:33,37 [29] )
+|"InputTestTagHelper, AppCode"|
+
+Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Date|
+Generated Location: (2200:49,102 [4] )
+|Date|
+
+Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Model|
+Generated Location: (2592:56,94 [5] )
+|Model|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs
new file mode 100644
index 0000000000..8fb69e52ed
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs
@@ -0,0 +1,104 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0906a816db301fe624bbe5a96c4b3013071ea492"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt
new file mode 100644
index 0000000000..b336b645b0
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt
@@ -0,0 +1,69 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs
new file mode 100644
index 0000000000..c01f69d243
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt
new file mode 100644
index 0000000000..c18b0cd554
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt
@@ -0,0 +1,36 @@
+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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt
new file mode 100644
index 0000000000..7d84cf754d
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs
new file mode 100644
index 0000000000..cd4f57b409
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs
@@ -0,0 +1,33 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "31c5b047a450ac9f6dc4116626667d26bfb657ba"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model_cshtml : 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt
new file mode 100644
index 0000000000..3f8d705381
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt
@@ -0,0 +1,16 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml
new file mode 100644
index 0000000000..350f93b776
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml
@@ -0,0 +1,2 @@
+@model ThisShouldBeGenerated
+@model System.Collections.IEnumerable
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs
new file mode 100644
index 0000000000..2ff817c2ca
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml"
+System.Collections.IEnumerable __typeHelper = default;
+
+#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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..2fe8233c66
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt
new file mode 100644
index 0000000000..a1ef9941e3
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_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_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 - (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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt
new file mode 100644
index 0000000000..8853f2b5d9
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_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: (1006:27,0 [30] )
+|System.Collections.IEnumerable|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml
new file mode 100644
index 0000000000..7438788ff4
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml
@@ -0,0 +1,14 @@
+@model DateTime
+
+@addTagHelper "InputTestTagHelper, AppCode"
+
+@{
+ Layout = "_SectionTestLayout.cshtml";
+}
+
+Some body
+
+@section Section1 {
+ This is in Section 1
+
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
new file mode 100644
index 0000000000..a720d28d50
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
@@ -0,0 +1,86 @@
+//
+#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_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #line hidden
+ #pragma warning disable 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ #pragma warning restore 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ private global::InputTestTagHelper __InputTestTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
+DateTime __typeHelper = default;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
+global::System.Object __typeHelper = "InputTestTagHelper, AppCode";
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
+global::System.Object Section1 = 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()
+ {
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
+
+ Layout = "_SectionTestLayout.cshtml";
+
+#line default
+#line hidden
+ DefineSection("Section1", async(__razor_section_writer) => {
+ __InputTestTagHelper = CreateTagHelper();
+#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Date);
+
+#line default
+#line hidden
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ }
+ );
+ }
+ #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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt
new file mode 100644
index 0000000000..35c27f4abb
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt
@@ -0,0 +1,73 @@
+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_Sections - 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 - (7:0,7 [8] Sections.cshtml) - DateTime
+ DirectiveToken - (33:2,14 [29] Sections.cshtml) - "InputTestTagHelper, AppCode"
+ DirectiveToken - (152:10,9 [8] Sections.cshtml) - Section1
+ 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] Sections.cshtml)
+ IntermediateToken - (17:1,0 [2] Sections.cshtml) - Html - \n
+ HtmlContent - (62:2,43 [4] Sections.cshtml)
+ IntermediateToken - (62:2,43 [4] Sections.cshtml) - Html - \n\n
+ CSharpCode - (68:4,2 [46] Sections.cshtml)
+ IntermediateToken - (68:4,2 [46] Sections.cshtml) - CSharp - \n Layout = "_SectionTestLayout.cshtml";\n
+ HtmlContent - (117:7,0 [26] Sections.cshtml)
+ IntermediateToken - (117:7,0 [2] Sections.cshtml) - Html - \n
+ IntermediateToken - (119:8,0 [4] Sections.cshtml) - Html -
+ IntermediateToken - (124:8,5 [9] Sections.cshtml) - Html - Some body
+ IntermediateToken - (133:8,14 [6] Sections.cshtml) - Html -
+ IntermediateToken - (139:8,20 [4] Sections.cshtml) - Html - \n\n
+ Section - - Section1
+ HtmlContent - (162:10,19 [43] Sections.cshtml)
+ IntermediateToken - (162:10,19 [6] Sections.cshtml) - Html - \n
+ IntermediateToken - (168:11,4 [4] Sections.cshtml) - Html -
+ IntermediateToken - (173:11,9 [20] Sections.cshtml) - Html - This is in Section 1
+ IntermediateToken - (193:11,29 [6] Sections.cshtml) - Html -
+ IntermediateToken - (199:11,35 [6] Sections.cshtml) - Html - \n
+ TagHelper - (205:12,4 [25] Sections.cshtml) - input-test - TagMode.SelfClosing
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - InputTestTagHelper
+ DefaultTagHelperProperty - (222:12,21 [4] Sections.cshtml) - for - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression InputTestTagHelper.For - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression -
+ IntermediateToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model =>
+ IntermediateToken - - CSharp - __model.
+ IntermediateToken - (222:12,21 [4] Sections.cshtml) - CSharp - Date
+ IntermediateToken - - CSharp - )
+ DefaultTagHelperExecute -
+ HtmlContent - (230:12,29 [2] Sections.cshtml)
+ IntermediateToken - (230:12,29 [2] Sections.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
new file mode 100644
index 0000000000..ba25b7bb6b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
@@ -0,0 +1,29 @@
+Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|DateTime|
+Generated Location: (1227:25,0 [8] )
+|DateTime|
+
+Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|"InputTestTagHelper, AppCode"|
+Generated Location: (1473:33,37 [29] )
+|"InputTestTagHelper, AppCode"|
+
+Source Location: (152:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|Section1|
+Generated Location: (1703:41,22 [8] )
+|Section1|
+
+Source Location: (68:4,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|
+ Layout = "_SectionTestLayout.cshtml";
+|
+Generated Location: (2169:56,2 [46] )
+|
+ Layout = "_SectionTestLayout.cshtml";
+|
+
+Source Location: (222:12,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|Date|
+Generated Location: (2594:64,102 [4] )
+|Date|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml
new file mode 100644
index 0000000000..0430ccfc69
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml
@@ -0,0 +1,6 @@
+@addTagHelper "*, AppCode"
+@{
+ var foo = "Hello";
+}
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs
new file mode 100644
index 0000000000..90293d54ca
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs
@@ -0,0 +1,90 @@
+//
+#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_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #line hidden
+ #pragma warning disable 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
+ #pragma warning restore 0649
+ private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
+ private global::AllTagHelper __AllTagHelper;
+ private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.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()
+ {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml"
+
+ var foo = "Hello";
+
+#line default
+#line hidden
+ __AllTagHelper = CreateTagHelper();
+ __TestViewComponentTagHelper = CreateTagHelper();
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml"
+ __o = foo;
+
+#line default
+#line hidden
+ __TestViewComponentTagHelper.firstName = string.Empty;
+ __AllTagHelper.Bar = " World";
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ }
+ #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; }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("vc:test")]
+ public class __Generated__TestViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
+ {
+ private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper _helper = null;
+ public __Generated__TestViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
+ {
+ _helper = helper;
+ }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
+ public System.String firstName { get; set; }
+ public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
+ {
+ (_helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
+ var content = await _helper.InvokeAsync("Test", new { firstName });
+ output.TagName = null;
+ output.Content.SetHtmlContent(content);
+ }
+ }
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt
new file mode 100644
index 0000000000..328b11876d
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt
@@ -0,0 +1,57 @@
+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_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper
+ FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper
+ 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 - (14:0,14 [12] ViewComponentTagHelper.cshtml) - "*, 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 - (26:0,26 [2] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (26:0,26 [2] ViewComponentTagHelper.cshtml) - Html - \n
+ CSharpCode - (30:1,2 [26] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (30:1,2 [26] ViewComponentTagHelper.cshtml) - CSharp - \n var foo = "Hello";\n
+ HtmlContent - (59:4,0 [2] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (59:4,0 [2] ViewComponentTagHelper.cshtml) - Html - \n
+ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - AllTagHelper
+ DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper
+ DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo
+ DefaultTagHelperProperty - (93:5,32 [6] ViewComponentTagHelper.cshtml) - bar - string AllTagHelper.Bar - HtmlAttributeValueStyle.DoubleQuotes
+ HtmlContent - (93:5,32 [6] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (93:5,32 [6] ViewComponentTagHelper.cshtml) - Html - World
+ DefaultTagHelperExecute -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ ViewComponentTagHelper -
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt
new file mode 100644
index 0000000000..1af3082e0e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt
@@ -0,0 +1,19 @@
+Source Location: (14:0,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml)
+|"*, AppCode"|
+Generated Location: (1465:26,37 [12] )
+|"*, AppCode"|
+
+Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml)
+|
+ var foo = "Hello";
+|
+Generated Location: (1942:41,2 [26] )
+|
+ var foo = "Hello";
+|
+
+Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml)
+|foo|
+Generated Location: (2393:49,22 [3] )
+|foo|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs
new file mode 100644
index 0000000000..2c85bf513c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs
@@ -0,0 +1,110 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6a0ad3c59f3a87877c36928472f0508bd40cdd8c"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;
+ private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("bar", " World", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
+ #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::AllTagHelper __AllTagHelper;
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml"
+
+ var foo = "Hello";
+
+#line default
+#line hidden
+ BeginContext(59, 2, true);
+ WriteLiteral("\r\n");
+ EndContext();
+ BeginContext(61, 50, false);
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
+ }
+ );
+ __AllTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__AllTagHelper);
+ __TestViewComponentTagHelper = CreateTagHelper();
+ __tagHelperExecutionContext.Add(__TestViewComponentTagHelper);
+ BeginWriteTagHelperAttribute();
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml"
+ WriteLiteral(foo);
+
+#line default
+#line hidden
+ __tagHelperStringValueBuffer = EndWriteTagHelperAttribute();
+ __TestViewComponentTagHelper.firstName = __tagHelperStringValueBuffer;
+ __tagHelperExecutionContext.AddTagHelperAttribute("first-name", __TestViewComponentTagHelper.firstName, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
+ __AllTagHelper.Bar = (string)__tagHelperAttribute_0.Value;
+ __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
+ await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
+ if (!__tagHelperExecutionContext.Output.IsContentModified)
+ {
+ await __tagHelperExecutionContext.SetOutputContentAsync();
+ }
+ Write(__tagHelperExecutionContext.Output);
+ __tagHelperExecutionContext = __tagHelperScopeManager.End();
+ 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; }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("vc:test")]
+public class __Generated__TestViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
+{
+ private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper _helper = null;
+ public __Generated__TestViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
+ {
+ _helper = helper;
+ }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
+ public System.String firstName { get; set; }
+ public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
+ {
+ (_helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
+ var content = await _helper.InvokeAsync("Test", new { firstName });
+ output.TagName = null;
+ output.Content.SetHtmlContent(content);
+ }
+}
+
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt
new file mode 100644
index 0000000000..a1678711eb
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt
@@ -0,0 +1,43 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper
+ PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - bar - World - HtmlAttributeValueStyle.DoubleQuotes
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper
+ MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync
+ CSharpCode - (30:1,2 [26] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (30:1,2 [26] ViewComponentTagHelper.cshtml) - CSharp - \n var foo = "Hello";\n
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(59, 2, true);
+ HtmlContent - (59:4,0 [2] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (59:4,0 [2] ViewComponentTagHelper.cshtml) - Html - \n
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ CSharpCode -
+ IntermediateToken - - CSharp - BeginContext(61, 50, false);
+ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag
+ DefaultTagHelperBody -
+ DefaultTagHelperCreate - - AllTagHelper
+ DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml.__Generated__TestViewComponentTagHelper
+ DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes
+ CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml)
+ IntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo
+ PreallocatedTagHelperProperty - (93:5,32 [6] ViewComponentTagHelper.cshtml) - __tagHelperAttribute_0 - bar - Bar
+ DefaultTagHelperExecute -
+ CSharpCode -
+ IntermediateToken - - CSharp - EndContext();
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ CSharpCode -
+ IntermediateToken - - CSharp - [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("vc:test")]\npublic class __Generated__TestViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper\n{\n private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper _helper = null;\n public __Generated__TestViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)\n {\n _helper = helper;\n }\n [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]\n public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }\n public System.String firstName { get; set; }\n public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)\n {\n (_helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);\n var content = await _helper.InvokeAsync("Test", new { firstName });\n output.TagName = null;\n output.Content.SetHtmlContent(content);\n }\n}\n
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml
new file mode 100644
index 0000000000..f4e110d289
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml
@@ -0,0 +1 @@
+@inject IHtmlHelper Helper
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs
new file mode 100644
index 0000000000..363ff66ca5
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_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__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml"
+IHtmlHelper __typeHelper = default;
+
+#line default
+#line hidden
+ }
+ ))();
+ ((System.Action)(() => {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml"
+global::System.Object Helper = 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 IHtmlHelper Helper { 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt
new file mode 100644
index 0000000000..f75113d4b6
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_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__ViewImports - 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 - (8:0,8 [19] _ViewImports.cshtml) - IHtmlHelper
+ DirectiveToken - (28:0,28 [6] _ViewImports.cshtml) - Helper
+ 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt
new file mode 100644
index 0000000000..6b845596b5
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt
@@ -0,0 +1,10 @@
+Source Location: (8:0,8 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml)
+|IHtmlHelper|
+Generated Location: (760:19,0 [19] )
+|IHtmlHelper|
+
+Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml)
+|Helper|
+Generated Location: (1006:27,22 [6] )
+|Helper|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs
new file mode 100644
index 0000000000..2400a20b50
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs
@@ -0,0 +1,35 @@
+#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e57bbc3e746e8b13b4c33d8df0e022bd397d8caa"
+//
+#pragma warning disable 1591
+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;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports_cshtml : 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 IHtmlHelper Helper { 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt
new file mode 100644
index 0000000000..3703d64a46
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt
@@ -0,0 +1,17 @@
+Document -
+ 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
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports_cshtml - 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/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorFactoryTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorFactoryTest.cs
new file mode 100644
index 0000000000..491a2faaab
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorFactoryTest.cs
@@ -0,0 +1,343 @@
+// 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.Reflection;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.CodeAnalysis;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ public class ViewComponentTagHelperDescriptorFactoryTest
+ {
+ private static readonly Assembly _assembly = typeof(ViewComponentTagHelperDescriptorFactoryTest).GetTypeInfo().Assembly;
+
+ [Fact]
+ public void CreateDescriptor_UnderstandsStringParameters()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(StringParameterViewComponent).FullName);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var expectedDescriptor = TagHelperDescriptorBuilder.Create(
+ ViewComponentTagHelperConventions.Kind,
+ "__Generated__StringParameterViewComponentTagHelper",
+ typeof(StringParameterViewComponent).GetTypeInfo().Assembly.GetName().Name)
+ .TypeName("__Generated__StringParameterViewComponentTagHelper")
+ .DisplayName("StringParameterViewComponentTagHelper")
+ .TagMatchingRuleDescriptor(rule =>
+ rule
+ .RequireTagName("vc:string-parameter")
+ .RequireAttributeDescriptor(attribute => attribute.Name("foo"))
+ .RequireAttributeDescriptor(attribute => attribute.Name("bar")))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("foo")
+ .PropertyName("foo")
+ .TypeName(typeof(string).FullName)
+ .DisplayName("string StringParameterViewComponentTagHelper.foo"))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("bar")
+ .PropertyName("bar")
+ .TypeName(typeof(string).FullName)
+ .DisplayName("string StringParameterViewComponentTagHelper.bar"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "StringParameter")
+ .Build();
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
+ }
+
+ [Fact]
+ public void CreateDescriptor_UnderstandsVariousParameterTypes()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(VariousParameterViewComponent).FullName);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var expectedDescriptor = TagHelperDescriptorBuilder.Create(
+ ViewComponentTagHelperConventions.Kind,
+ "__Generated__VariousParameterViewComponentTagHelper",
+ typeof(VariousParameterViewComponent).GetTypeInfo().Assembly.GetName().Name)
+ .TypeName("__Generated__VariousParameterViewComponentTagHelper")
+ .DisplayName("VariousParameterViewComponentTagHelper")
+ .TagMatchingRuleDescriptor(rule =>
+ rule
+ .RequireTagName("vc:various-parameter")
+ .RequireAttributeDescriptor(attribute => attribute.Name("test-enum"))
+ .RequireAttributeDescriptor(attribute => attribute.Name("test-string"))
+ .RequireAttributeDescriptor(attribute => attribute.Name("baz")))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("test-enum")
+ .PropertyName("testEnum")
+ .TypeName(typeof(VariousParameterViewComponent).FullName + "." + nameof(VariousParameterViewComponent.TestEnum))
+ .AsEnum()
+ .DisplayName(typeof(VariousParameterViewComponent).FullName + "." + nameof(VariousParameterViewComponent.TestEnum) + " VariousParameterViewComponentTagHelper.testEnum"))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("test-string")
+ .PropertyName("testString")
+ .TypeName(typeof(string).FullName)
+ .DisplayName("string VariousParameterViewComponentTagHelper.testString"))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("baz")
+ .PropertyName("baz")
+ .TypeName(typeof(int).FullName)
+ .DisplayName("int VariousParameterViewComponentTagHelper.baz"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "VariousParameter")
+ .Build();
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
+ }
+
+ [Fact]
+ public void CreateDescriptor_UnderstandsGenericParameters()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(GenericParameterViewComponent).FullName);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var expectedDescriptor = TagHelperDescriptorBuilder.Create(
+ ViewComponentTagHelperConventions.Kind,
+ "__Generated__GenericParameterViewComponentTagHelper",
+ typeof(GenericParameterViewComponent).GetTypeInfo().Assembly.GetName().Name)
+ .TypeName("__Generated__GenericParameterViewComponentTagHelper")
+ .DisplayName("GenericParameterViewComponentTagHelper")
+ .TagMatchingRuleDescriptor(rule =>
+ rule
+ .RequireTagName("vc:generic-parameter")
+ .RequireAttributeDescriptor(attribute => attribute.Name("foo")))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("foo")
+ .PropertyName("Foo")
+ .TypeName("System.Collections.Generic.List")
+ .DisplayName("System.Collections.Generic.List GenericParameterViewComponentTagHelper.Foo"))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("bar")
+ .PropertyName("Bar")
+ .TypeName("System.Collections.Generic.Dictionary")
+ .AsDictionaryAttribute("bar-", typeof(int).FullName)
+ .DisplayName("System.Collections.Generic.Dictionary GenericParameterViewComponentTagHelper.Bar"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "GenericParameter")
+ .Build();
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default);
+ }
+
+ [Fact]
+ public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoInvokeMethod()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(ViewComponentWithoutInvokeMethod).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_CannotFindMethod.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsGenericTask()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithGenericTask).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ Assert.Empty(descriptor.GetAllDiagnostics());
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsNonGenericTask()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithNonGenericTask).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ Assert.Empty(descriptor.GetAllDiagnostics());
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandVoid()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithString).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_AsyncMethod_ShouldReturnTask.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandString()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithString).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_AsyncMethod_ShouldReturnTask.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandVoid()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithVoid).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_SyncMethod_ShouldReturnValue.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandNonGenericTask()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithNonGenericTask).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_SyncMethod_CannotReturnTask.Id, diagnostic.Id);
+ }
+
+ [Fact]
+ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandGenericTask()
+ {
+ // Arrange
+ var testCompilation = TestCompilation.Create(_assembly);
+ var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation);
+
+ var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithGenericTask).FullName);
+
+ // Act
+ var descriptor = factory.CreateDescriptor(viewComponent);
+
+ // Assert
+ var diagnostic = Assert.Single(descriptor.GetAllDiagnostics());
+ Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_SyncMethod_CannotReturnTask.Id, diagnostic.Id);
+ }
+ }
+
+ public class StringParameterViewComponent
+ {
+ public string Invoke(string foo, string bar) => null;
+ }
+
+ public class VariousParameterViewComponent
+ {
+ public string Invoke(TestEnum testEnum, string testString, int baz = 5) => null;
+
+ public enum TestEnum
+ {
+ A = 1,
+ B = 2,
+ C = 3
+ }
+ }
+
+ public class GenericParameterViewComponent
+ {
+ public string Invoke(List Foo, Dictionary Bar) => null;
+ }
+
+ public class ViewComponentWithoutInvokeMethod
+ {
+ }
+
+ public class AsyncViewComponentWithGenericTask
+ {
+ public Task InvokeAsync() => null;
+ }
+
+ public class AsyncViewComponentWithNonGenericTask
+ {
+ public Task InvokeAsync() => null;
+ }
+
+ public class AsyncViewComponentWithVoid
+ {
+ public void InvokeAsync() { }
+ }
+
+ public class AsyncViewComponentWithString
+ {
+ public string InvokeAsync() => null;
+ }
+
+ public class SyncViewComponentWithVoid
+ {
+ public void Invoke() { }
+ }
+
+ public class SyncViewComponentWithNonGenericTask
+ {
+ public Task Invoke() => null;
+ }
+
+ public class SyncViewComponentWithGenericTask
+ {
+ public Task Invoke() => null;
+ }
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorProviderTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorProviderTest.cs
new file mode 100644
index 0000000000..862b97d715
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperDescriptorProviderTest.cs
@@ -0,0 +1,71 @@
+// 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.Linq;
+using System.Reflection;
+using Microsoft.AspNetCore.Razor.Language;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Razor;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ // This is just a basic integration test. There are detailed tests for the VCTH visitor and descriptor factory.
+ public class ViewComponentTagHelperDescriptorProviderTest
+ {
+ [Fact]
+ public void DescriptorProvider_FindsVCTH()
+ {
+ // Arrange
+ var code = @"
+ public class StringParameterViewComponent
+ {
+ public string Invoke(string foo, string bar) => null;
+ }
+";
+
+ var compilation = MvcShim.BaseCompilation.AddSyntaxTrees(CSharpSyntaxTree.ParseText(code));
+
+ var context = TagHelperDescriptorProviderContext.Create();
+ context.SetCompilation(compilation);
+
+ var provider = new ViewComponentTagHelperDescriptorProvider()
+ {
+ Engine = RazorProjectEngine.CreateEmpty().Engine,
+ };
+
+ var expectedDescriptor = TagHelperDescriptorBuilder.Create(
+ ViewComponentTagHelperConventions.Kind,
+ "__Generated__StringParameterViewComponentTagHelper",
+ TestCompilation.AssemblyName)
+ .TypeName("__Generated__StringParameterViewComponentTagHelper")
+ .DisplayName("StringParameterViewComponentTagHelper")
+ .TagMatchingRuleDescriptor(rule =>
+ rule
+ .RequireTagName("vc:string-parameter")
+ .RequireAttributeDescriptor(attribute => attribute.Name("foo"))
+ .RequireAttributeDescriptor(attribute => attribute.Name("bar")))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("foo")
+ .PropertyName("foo")
+ .TypeName(typeof(string).FullName)
+ .DisplayName("string StringParameterViewComponentTagHelper.foo"))
+ .BoundAttributeDescriptor(attribute =>
+ attribute
+ .Name("bar")
+ .PropertyName("bar")
+ .TypeName(typeof(string).FullName)
+ .DisplayName("string StringParameterViewComponentTagHelper.bar"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "StringParameter")
+ .Build();
+
+ // Act
+ provider.Execute(context);
+
+ // Assert
+ Assert.Single(context.Results, d => TagHelperDescriptorComparer.Default.Equals(d, expectedDescriptor));
+ }
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperPassTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperPassTest.cs
new file mode 100644
index 0000000000..befa9d011c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperPassTest.cs
@@ -0,0 +1,275 @@
+// 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.Linq;
+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.Version1_X
+{
+ public class ViewComponentTagHelperPassTest
+ {
+ [Fact]
+ public void ViewComponentTagHelperPass_Execute_IgnoresRegularTagHelper()
+ {
+ // Arrange
+ var codeDocument = CreateDocument(@"
+@addTagHelper TestTagHelper, TestAssembly
+");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly")
+ .TypeName("TestTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .Name("Foo")
+ .TypeName("System.Int32"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p"))
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ViewComponentTagHelperPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var @class = FindClassNode(irDocument);
+ Assert.Equal(3, @class.Children.Count); // No class node created for a VCTH
+ for (var i = 0; i < @class.Children.Count; i++)
+ {
+ Assert.IsNotType(@class.Children[i]);
+ }
+ }
+
+ [Fact]
+ public void ViewComponentTagHelperPass_Execute_CreatesViewComponentTagHelper()
+ {
+ // Arrange
+ var codeDocument = CreateDocument(@"
+@addTagHelper TestTagHelper, TestAssembly
+");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create(ViewComponentTagHelperConventions.Kind, "TestTagHelper", "TestAssembly")
+ .TypeName("__Generated__TagCloudViewComponentTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .Name("Foo")
+ .TypeName("System.Int32")
+ .PropertyName("Foo"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tagcloud"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "TagCloud")
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ViewComponentTagHelperPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var tagHelper = FindTagHelperNode(irDocument);
+ Assert.Equal(vcthFullName, Assert.IsType(tagHelper.Children[1]).TypeName);
+ Assert.Equal("Foo", Assert.IsType(tagHelper.Children[2]).PropertyName);
+
+
+ var @class = FindClassNode(irDocument);
+ Assert.Equal(4, @class.Children.Count);
+
+ Assert.IsType(@class.Children.Last());
+ }
+
+ [Fact]
+ public void ViewComponentTagHelperPass_Execute_CreatesViewComponentTagHelper_WithIndexer()
+ {
+ // Arrange
+ var codeDocument = CreateDocument(@"
+@addTagHelper TestTagHelper, TestAssembly
+");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create(ViewComponentTagHelperConventions.Kind, "TestTagHelper", "TestAssembly")
+ .TypeName("__Generated__TagCloudViewComponentTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .Name("Foo")
+ .TypeName("System.Collections.Generic.Dictionary")
+ .PropertyName("Tags")
+ .AsDictionaryAttribute("foo-", "System.Int32"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tagcloud"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "TagCloud")
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ViewComponentTagHelperPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var tagHelper = FindTagHelperNode(irDocument);
+ Assert.Equal(vcthFullName, Assert.IsType(tagHelper.Children[1]).TypeName);
+ Assert.IsType(tagHelper.Children[2]);
+
+ var @class = FindClassNode(irDocument);
+ Assert.Equal(4, @class.Children.Count);
+
+ Assert.IsType(@class.Children[3]);
+ }
+
+ [Fact]
+ public void ViewComponentTagHelperPass_Execute_CreatesViewComponentTagHelper_Nested()
+ {
+ // Arrange
+ var codeDocument = CreateDocument(@"
+@addTagHelper *, TestAssembly
+
");
+
+ var tagHelpers = new[]
+ {
+ TagHelperDescriptorBuilder.Create("PTestTagHelper", "TestAssembly")
+ .TypeName("PTestTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .PropertyName("Foo")
+ .Name("Foo")
+ .TypeName("System.Int32"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p"))
+ .Build(),
+ TagHelperDescriptorBuilder.Create(ViewComponentTagHelperConventions.Kind, "TestTagHelper", "TestAssembly")
+ .TypeName("__Generated__TagCloudViewComponentTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .PropertyName("Foo")
+ .Name("Foo")
+ .TypeName("System.Int32"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tagcloud"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "TagCloud")
+ .Build()
+ };
+
+ var engine = CreateEngine(tagHelpers);
+ var pass = new ViewComponentTagHelperPass()
+ {
+ Engine = engine,
+ };
+
+ var irDocument = CreateIRDocument(engine, codeDocument);
+
+ var vcthFullName = "AspNetCore.test.__Generated__TagCloudViewComponentTagHelper";
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ var outerTagHelper = FindTagHelperNode(irDocument);
+ Assert.Equal("PTestTagHelper", Assert.IsType(outerTagHelper.Children[1]).TypeName);
+ Assert.Equal("Foo", Assert.IsType(outerTagHelper.Children[2]).PropertyName);
+
+ var vcth = FindTagHelperNode(outerTagHelper.Children[0]);
+ Assert.Equal(vcthFullName, Assert.IsType(vcth.Children[1]).TypeName);
+ Assert.Equal("Foo", Assert.IsType(vcth.Children[2]).PropertyName);
+
+
+ var @class = FindClassNode(irDocument);
+ Assert.Equal(5, @class.Children.Count);
+
+ Assert.IsType(@class.Children.Last());
+ }
+
+ 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 MvcViewDocumentClassifierPass());
+
+ 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;
+ }
+ }
+
+ // We also expect the default tag helper pass to run first.
+ var documentNode = codeDocument.GetDocumentIntermediateNode();
+
+ var defaultTagHelperPass = engine.Features.OfType().Single();
+ defaultTagHelperPass.Execute(codeDocument, documentNode);
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private ClassDeclarationIntermediateNode FindClassNode(IntermediateNode node)
+ {
+ var visitor = new ClassDeclarationNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private TagHelperIntermediateNode FindTagHelperNode(IntermediateNode node)
+ {
+ var visitor = new TagHelperNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private class ClassDeclarationNodeVisitor : IntermediateNodeWalker
+ {
+ public ClassDeclarationIntermediateNode Node { get; set; }
+
+ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
+ {
+ Node = node;
+ }
+ }
+
+ private class TagHelperNodeVisitor : IntermediateNodeWalker
+ {
+ public TagHelperIntermediateNode Node { get; set; }
+
+ public override void VisitTagHelper(TagHelperIntermediateNode node)
+ {
+ Node = node;
+ }
+ }
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperTargetExtensionTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperTargetExtensionTest.cs
new file mode 100644
index 0000000000..2e3c476a36
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTagHelperTargetExtensionTest.cs
@@ -0,0 +1,120 @@
+// 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.CodeGeneration;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ public class ViewComponentTagHelperTargetExtensionTest
+ {
+ [Fact]
+ public void WriteViewComponentTagHelper_GeneratesViewComponentTagHelper()
+ {
+ // Arrange
+ var tagHelper = TagHelperDescriptorBuilder
+ .Create(ViewComponentTagHelperConventions.Kind, "TestTagHelper", "TestAssembly")
+ .TypeName("__Generated__TagCloudViewComponentTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .Name("Foo")
+ .TypeName("System.Int32")
+ .PropertyName("Foo"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tagcloud"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "TagCloud")
+ .Build();
+
+ var extension = new ViewComponentTagHelperTargetExtension();
+ var context = TestCodeRenderingContext.CreateRuntime();
+ var node = new ViewComponentTagHelperIntermediateNode()
+ {
+ ClassName = "__Generated__TagCloudViewComponentTagHelper",
+ TagHelper = tagHelper
+ };
+
+ // Act
+ extension.WriteViewComponentTagHelper(context, node);
+
+ // Assert
+ var csharp = context.CodeWriter.GenerateCode();
+ Assert.Equal(
+ @"[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(""tagcloud"")]
+public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
+{
+ private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper _helper = null;
+ public __Generated__TagCloudViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
+ {
+ _helper = helper;
+ }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
+ public System.Int32 Foo { get; set; }
+ public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
+ {
+ (_helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
+ var content = await _helper.InvokeAsync(""TagCloud"", new { Foo });
+ output.TagName = null;
+ output.Content.SetHtmlContent(content);
+ }
+}
+",
+ csharp,
+ ignoreLineEndingDifferences: true);
+ }
+
+ [Fact]
+ public void WriteViewComponentTagHelper_GeneratesViewComponentTagHelper_WithIndexer()
+ {
+ // Arrange
+ var tagHelper = TagHelperDescriptorBuilder
+ .Create(ViewComponentTagHelperConventions.Kind, "TestTagHelper", "TestAssembly")
+ .TypeName("__Generated__TagCloudViewComponentTagHelper")
+ .BoundAttributeDescriptor(attribute => attribute
+ .Name("Foo")
+ .TypeName("System.Collections.Generic.Dictionary")
+ .PropertyName("Tags")
+ .AsDictionaryAttribute("foo-", "System.Int32"))
+ .TagMatchingRuleDescriptor(rule => rule.RequireTagName("tagcloud"))
+ .AddMetadata(ViewComponentTagHelperMetadata.Name, "TagCloud")
+ .Build();
+
+ var extension = new ViewComponentTagHelperTargetExtension();
+ var context = TestCodeRenderingContext.CreateRuntime();
+ var node = new ViewComponentTagHelperIntermediateNode()
+ {
+ ClassName = "__Generated__TagCloudViewComponentTagHelper",
+ TagHelper = tagHelper
+ };
+
+ // Act
+ extension.WriteViewComponentTagHelper(context, node);
+
+ // Assert
+ var csharp = context.CodeWriter.GenerateCode();
+ Assert.Equal(
+ @"[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(""tagcloud"")]
+public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
+{
+ private readonly global::Microsoft.AspNetCore.Mvc.IViewComponentHelper _helper = null;
+ public __Generated__TagCloudViewComponentTagHelper(global::Microsoft.AspNetCore.Mvc.IViewComponentHelper helper)
+ {
+ _helper = helper;
+ }
+ [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNotBoundAttribute, global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { get; set; }
+ public System.Collections.Generic.Dictionary Tags { get; set; }
+ = new System.Collections.Generic.Dictionary();
+ public override async global::System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output)
+ {
+ (_helper as global::Microsoft.AspNetCore.Mvc.ViewFeatures.IViewContextAware)?.Contextualize(ViewContext);
+ var content = await _helper.InvokeAsync(""TagCloud"", new { Tags });
+ output.TagName = null;
+ output.Content.SetHtmlContent(content);
+ }
+}
+",
+ csharp,
+ ignoreLineEndingDifferences: true);
+ }
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTypeVisitorTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTypeVisitorTest.cs
new file mode 100644
index 0000000000..96d879756c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ViewComponentTypeVisitorTest.cs
@@ -0,0 +1,202 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Microsoft.CodeAnalysis;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ public class ViewComponentTypeVisitorTest
+ {
+ private static readonly Assembly _assembly = typeof(ViewComponentTypeVisitorTest).GetTypeInfo().Assembly;
+
+ private static Compilation Compilation { get; } = TestCompilation.Create(_assembly);
+
+ // In practice MVC will provide a marker attribute for ViewComponents. To prevent a circular reference between MVC and Razor
+ // we can use a test class as a marker.
+ private static INamedTypeSymbol TestViewComponentAttributeSymbol { get; } = Compilation.GetTypeByMetadataName(typeof(TestViewComponentAttribute).FullName);
+ private static INamedTypeSymbol TestNonViewComponentAttributeSymbol { get; } = Compilation.GetTypeByMetadataName(typeof(TestNonViewComponentAttribute).FullName);
+
+ [Fact]
+ public void IsViewComponent_PlainViewComponent_ReturnsTrue()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List