(@namespace.Children[0]);
+ Assert.Equal($"TModel = global::System.Object", usingNode.Content);
+ }
+
+ private RazorCodeDocument CreateDocument(string content)
+ {
+ var source = RazorSourceDocument.Create(content, "test.cshtml");
+ return RazorCodeDocument.Create(source);
+ }
+
+ private ClassDeclarationIntermediateNode FindClassNode(IntermediateNode node)
+ {
+ var visitor = new ClassNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private NamespaceDeclarationIntermediateNode FindNamespaceNode(IntermediateNode node)
+ {
+ var visitor = new NamespaceNodeVisitor();
+ visitor.Visit(node);
+ return visitor.Node;
+ }
+
+ private RazorEngine CreateEngine()
+ {
+ return RazorEngine.Create(b =>
+ {
+ // Notice we're not registering the ModelDirective.Pass here so we can run it on demand.
+ b.AddDirective(ModelDirective.Directive);
+
+ // There's some special interaction with the inherits directive
+ InheritsDirective.Register(b);
+ });
+ }
+
+ 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;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ModelExpressionPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ModelExpressionPassTest.cs
new file mode 100644
index 0000000000..604460c8f8
--- /dev/null
+++ b/test/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 RazorEngine.Create(b =>
+ {
+ b.Features.Add(new TestTagHelperFeature(tagHelpers));
+ });
+ }
+
+ 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcRazorTemplateEngineTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcRazorTemplateEngineTest.cs
new file mode 100644
index 0000000000..b4954469bc
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcRazorTemplateEngineTest.cs
@@ -0,0 +1,116 @@
+// 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.Linq;
+using Microsoft.AspNetCore.Razor.Language;
+using Moq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ public class MvcRazorTemplateEngineTest
+ {
+ [Fact]
+ public void GetDefaultImports_IncludesDefaultImports()
+ {
+ // Arrange
+ var expectedImports = new[]
+ {
+ "@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",
+ };
+ var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
+ RazorEngine.Create(),
+ new TestRazorProject());
+
+ // Act
+ var imports = mvcRazorTemplateEngine.Options.DefaultImports;
+
+ // Assert
+ var importContent = GetContent(imports)
+ .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
+ .Where(line => line.StartsWith("@using"));
+ Assert.Equal(expectedImports, importContent);
+ }
+
+ [Fact]
+ public void GetDefaultImports_IncludesDefaulInjects()
+ {
+ // Arrange
+ var expectedImports = new[]
+ {
+ "@inject global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html",
+ "@inject global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json",
+ "@inject global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component",
+ "@inject global::Microsoft.AspNetCore.Mvc.IUrlHelper Url",
+ "@inject global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider",
+ };
+ var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
+ RazorEngine.Create(),
+ new TestRazorProject());
+
+ // Act
+ var imports = mvcRazorTemplateEngine.Options.DefaultImports;
+
+ // Assert
+ var importContent = GetContent(imports)
+ .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
+ .Where(line => line.StartsWith("@inject"));
+ Assert.Equal(expectedImports, importContent);
+ }
+
+ [Fact]
+ public void GetDefaultImports_IncludesDefaultTagHelpers()
+ {
+ // Arrange
+ var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
+ RazorEngine.Create(),
+ new TestRazorProject());
+
+ // Act
+ var imports = mvcRazorTemplateEngine.Options.DefaultImports;
+
+ // Assert
+ var importContent = GetContent(imports)
+ .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
+ .Where(line => line.StartsWith("@addTagHelper"));
+ Assert.Contains("@addTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor", importContent);
+ }
+
+ [Fact]
+ public void CreateCodeDocument_SetsRelativePathOnOutput()
+ {
+ // Arrange
+ var path = "/Views/Home/Index.cshtml";
+ var item = new TestRazorProjectItem(path)
+ {
+ Content = "Hello world",
+ };
+ var project = new TestRazorProject(new List() { item, });
+
+ var mvcRazorTemplateEngine = new MvcRazorTemplateEngine(
+ RazorEngine.Create(),
+ project);
+
+ // Act
+ var codeDocument = mvcRazorTemplateEngine.CreateCodeDocument(path);
+
+ // Assert
+ Assert.Equal(path, codeDocument.GetRelativePath());
+ }
+
+ private string GetContent(RazorSourceDocument imports)
+ {
+ var contentChars = new char[imports.Length];
+ imports.CopyTo(0, contentChars, 0, imports.Length);
+ return new string(contentChars);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcViewDocumentClassifierPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcViewDocumentClassifierPassTest.cs
new file mode 100644
index 0000000000..d0b8361965
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/MvcViewDocumentClassifierPassTest.cs
@@ -0,0 +1,242 @@
+// 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 Microsoft.AspNetCore.Razor.Language;
+using Microsoft.AspNetCore.Razor.Language.Intermediate;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
+{
+ public class MvcViewDocumentClassifierPassTest
+ {
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsDocumentKind()
+ {
+ // Arrange
+ var codeDocument = CreateDocument("some-content");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("mvc.1.0.view", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_NoOpsIfDocumentKindIsAlreadySet()
+ {
+ // Arrange
+ var codeDocument = CreateDocument("some-content");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ irDocument.DocumentKind = "some-value";
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+
+ // Assert
+ Assert.Equal("some-value", irDocument.DocumentKind);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsNamespace()
+ {
+ // Arrange
+ var codeDocument = CreateDocument("some-content");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = 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 codeDocument = CreateDocument("some-content");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+ codeDocument.SetRelativePath("Test.cshtml");
+
+ // 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_cshtml", visitor.Class.ClassName);
+ }
+
+ [Theory]
+ [InlineData("/Views/Home/Index.cshtml", "_Views_Home_Index_cshtml")]
+ [InlineData("/Areas/MyArea/Views/Home/About.cshtml", "_Areas_MyArea_Views_Home_About_cshtml")]
+ public void MvcViewDocumentClassifierPass_UsesRelativePathToGenerateTypeName(string relativePath, string expected)
+ {
+ // Arrange
+ var codeDocument = CreateDocument("some-content");
+ codeDocument.SetRelativePath(relativePath);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = 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 expected = "x___application_Views_Home_Index_cshtml";
+ var path = @"x::\application\Views\Home\Index.cshtml";
+ var codeDocument = CreateDocument("some-content", path);
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal(expected, visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SanitizesClassName()
+ {
+ // Arrange
+ var expected = "path_with_invalid_chars";
+ var codeDocument = CreateDocument("some-content");
+ codeDocument.SetRelativePath("path.with+invalid-chars");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal(expected, visitor.Class.ClassName);
+ }
+
+ [Fact]
+ public void MvcViewDocumentClassifierPass_SetsUpExecuteAsyncMethod()
+ {
+ // Arrange
+ var codeDocument = CreateDocument("some-content");
+ var engine = CreateEngine();
+ var irDocument = CreateIRDocument(engine, codeDocument);
+ var pass = new MvcViewDocumentClassifierPass
+ {
+ Engine = engine
+ };
+
+ // Act
+ pass.Execute(codeDocument, irDocument);
+ var visitor = new Visitor();
+ visitor.Visit(irDocument);
+
+ // Assert
+ Assert.Equal("ExecuteAsync", visitor.Method.MethodName);
+ Assert.Equal("global::System.Threading.Tasks.Task", visitor.Method.ReturnType);
+ Assert.Equal(new[] { "public", "async", "override" }, visitor.Method.Modifiers);
+ }
+
+ private static RazorCodeDocument CreateDocument(string content, string filePath = null)
+ {
+ filePath = filePath ?? Path.Combine(Directory.GetCurrentDirectory(), "Test.cshtml");
+
+ var source = RazorSourceDocument.Create(content, filePath);
+ return RazorCodeDocument.Create(source);
+ }
+
+ private static RazorEngine CreateEngine() => RazorEngine.Create();
+
+ private static DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument)
+ {
+ for (var i = 0; i < engine.Phases.Count; i++)
+ {
+ var phase = engine.Phases[i];
+ phase.Execute(codeDocument);
+
+ if (phase is IRazorIntermediateNodeLoweringPhase)
+ {
+ break;
+ }
+ }
+
+ return codeDocument.GetDocumentIntermediateNode();
+ }
+
+ private class Visitor : IntermediateNodeWalker
+ {
+ public NamespaceDeclarationIntermediateNode Namespace { get; private set; }
+
+ public ClassDeclarationIntermediateNode Class { get; private set; }
+
+ public MethodDeclarationIntermediateNode Method { get; private set; }
+
+ public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node)
+ {
+ Method = node;
+ }
+
+ public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node)
+ {
+ Namespace = node;
+ base.VisitNamespaceDeclaration(node);
+ }
+
+ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node)
+ {
+ Class = node;
+ base.VisitClassDeclaration(node);
+ }
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..3337ebeac2
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/SourceMappingsSerializer.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/SourceMappingsSerializer.cs
new file mode 100644
index 0000000000..c081118d86
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TagHelperDescriptorExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TagHelperDescriptorExtensionsTest.cs
new file mode 100644
index 0000000000..f080719b5a
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml
new file mode 100644
index 0000000000..a20b20dae8
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs
new file mode 100644
index 0000000000..3edf343f5e
--- /dev/null
+++ b/test/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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ __o = this.ToString();
+
+#line default
+#line hidden
+#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+__o = string.Format("{0}", "Hello");
+
+#line default
+#line hidden
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+
+ var cls = "foo";
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ if(cls != null) {
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ __o = cls;
+
+#line default
+#line hidden
+#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml"
+ }
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
new file mode 100644
index 0000000000..ba42b7a0f4
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt
@@ -0,0 +1,62 @@
+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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt
new file mode 100644
index 0000000000..e25ebcea7e
--- /dev/null
+++ b/test/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: (1037:26,13 [15] )
+|this.ToString()|
+
+Source Location: (54:2,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|string.Format("{0}", "Hello")|
+Generated Location: (1173:31,6 [29] )
+|string.Format("{0}", "Hello")|
+
+Source Location: (95:4,2 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|
+ var cls = "foo";
+|
+Generated Location: (1319:36,2 [25] )
+|
+ var cls = "foo";
+|
+
+Source Location: (134:7,11 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|if(cls != null) { |
+Generated Location: (1467:42,11 [18] )
+|if(cls != null) { |
+
+Source Location: (153:7,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+|cls|
+Generated Location: (1629:47,30 [3] )
+|cls|
+
+Source Location: (156:7,33 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
+| }|
+Generated Location: (1780:52,33 [2] )
+| }|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml
new file mode 100644
index 0000000000..ecc90de2d6
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
new file mode 100644
index 0000000000..f47ba2071e
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs
@@ -0,0 +1,44 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyService __typeHelper = default(MyService);
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..72a8fa589b
--- /dev/null
+++ b/test/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 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
new file mode 100644
index 0000000000..79491f3568
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt
@@ -0,0 +1,54 @@
+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_cshtml - 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 - (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 - (83:0,83 [4] IncompleteDirectives.cshtml)
+ IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\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
+ 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
+ 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
new file mode 100644
index 0000000000..a0f227e239
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt
@@ -0,0 +1,5 @@
+Source Location: (133:7,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
+|MyService|
+Generated Location: (687:18,0 [17] )
+|MyService|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
new file mode 100644
index 0000000000..38efd570da
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml
@@ -0,0 +1,2 @@
+@inherits MyBasePageForViews
+@model MyModel
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..0c96a6c7e0
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_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_InheritsViewModel_cshtml : MyBasePageForViews
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyBasePageForViews __typeHelper = default(MyBasePageForViews);
+ }
+ ))();
+ ((System.Action)(() => {
+MyModel __typeHelper = default(MyModel);
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..1fba17672d
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..4f38bd7343
--- /dev/null
+++ b/test/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: (654:18,0 [26] )
+|MyBasePageForViews|
+
+Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml)
+|MyModel|
+Generated Location: (794:22,0 [7] )
+|MyModel|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
new file mode 100644
index 0000000000..c735e2e429
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml
@@ -0,0 +1 @@
+@model MyModel
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs
new file mode 100644
index 0000000000..a4a69f2b7f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs
@@ -0,0 +1,44 @@
+//
+#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_cshtml : MyBasePageForViews
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyModel __typeHelper = default(MyModel);
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt
new file mode 100644
index 0000000000..2da50d158b
--- /dev/null
+++ b/test/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_cshtml - MyBasePageForViews -
+ DesignTimeDirective -
+ DirectiveToken - (10:0,10 [26] InheritsWithViewImports_Imports0.cshtml) - MyBasePageForViews
+ 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] 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt
new file mode 100644
index 0000000000..bd614d72eb
--- /dev/null
+++ b/test/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: (660:18,0 [7] )
+|MyModel|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Imports0.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Imports0.cshtml
new file mode 100644
index 0000000000..4c14f15bad
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Imports0.cshtml
@@ -0,0 +1 @@
+@inherits MyBasePageForViews
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
new file mode 100644
index 0000000000..0aa749dd3f
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml
@@ -0,0 +1 @@
+@inject MyApp MyPropertyName
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml
new file mode 100644
index 0000000000..d699f1e754
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs
new file mode 100644
index 0000000000..10050cba80
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs
@@ -0,0 +1,62 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyModel __typeHelper = default(MyModel);
+ }
+ ))();
+ ((System.Action)(() => {
+MyApp __typeHelper = default(MyApp);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object MyPropertyName = null;
+ }
+ ))();
+ ((System.Action)(() => {
+MyService __typeHelper = default(MyService);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object Html = null;
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt
new file mode 100644
index 0000000000..e1d660ce8d
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt
new file mode 100644
index 0000000000..64bb4804b3
--- /dev/null
+++ b/test/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: (682:18,0 [7] )
+|MyModel|
+
+Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyApp|
+Generated Location: (784:22,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyPropertyName|
+Generated Location: (904:26,22 [14] )
+|MyPropertyName|
+
+Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|MyService|
+Generated Location: (988:30,0 [17] )
+|MyService|
+
+Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml)
+|Html|
+Generated Location: (1132:34,22 [4] )
+|Html|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml
new file mode 100644
index 0000000000..8cd61913e4
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs
new file mode 100644
index 0000000000..2c3776aedd
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_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_InjectWithSemicolon_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyModel __typeHelper = default(MyModel);
+ }
+ ))();
+ ((System.Action)(() => {
+MyApp __typeHelper = default(MyApp);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object MyPropertyName = null;
+ }
+ ))();
+ ((System.Action)(() => {
+MyService __typeHelper = default(MyService);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object Html = null;
+ }
+ ))();
+ ((System.Action)(() => {
+MyApp __typeHelper = default(MyApp);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object MyPropertyName2 = null;
+ }
+ ))();
+ ((System.Action)(() => {
+MyService __typeHelper = default(MyService);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object Html2 = null;
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName2 { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyService Html { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt
new file mode 100644
index 0000000000..4c0240ef2d
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt
new file mode 100644
index 0000000000..fb80df37b7
--- /dev/null
+++ b/test/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: (686:18,0 [7] )
+|MyModel|
+
+Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyApp|
+Generated Location: (788:22,0 [5] )
+|MyApp|
+
+Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName|
+Generated Location: (908:26,22 [14] )
+|MyPropertyName|
+
+Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (992:30,0 [17] )
+|MyService|
+
+Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html|
+Generated Location: (1136:34,22 [4] )
+|Html|
+
+Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyApp|
+Generated Location: (1210:38,0 [5] )
+|MyApp|
+
+Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyPropertyName2|
+Generated Location: (1330:42,22 [15] )
+|MyPropertyName2|
+
+Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|MyService|
+Generated Location: (1415:46,0 [17] )
+|MyService|
+
+Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml)
+|Html2|
+Generated Location: (1559:50,22 [5] )
+|Html2|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs
new file mode 100644
index 0000000000..b8e43e2f76
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs
@@ -0,0 +1,50 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+MyApp __typeHelper = default(MyApp);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object MyPropertyName = null;
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public MyApp MyPropertyName { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt
new file mode 100644
index 0000000000..e00df79298
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt
new file mode 100644
index 0000000000..ec01d63774
--- /dev/null
+++ b/test/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: (673:18,0 [5] )
+|MyApp|
+
+Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml)
+|MyPropertyName|
+Generated Location: (793:22,22 [14] )
+|MyPropertyName|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml
new file mode 100644
index 0000000000..6dfb72bc31
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs
new file mode 100644
index 0000000000..d4bee96fbd
--- /dev/null
+++ b/test/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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..cfbf688e18
--- /dev/null
+++ b/test/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 RZ9999: "namespace" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt
new file mode 100644
index 0000000000..59f3e7b070
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.mappings.txt b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.diagnostics.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
new file mode 100644
index 0000000000..4b73b2dc53
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml
@@ -0,0 +1 @@
+@model System.Collections.IEnumerable
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml
new file mode 100644
index 0000000000..c488b1e443
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
new file mode 100644
index 0000000000..8dc9887854
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs
@@ -0,0 +1,61 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ private global::InputTestTagHelper __InputTestTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+DateTime __typeHelper = default(DateTime);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "InputTestTagHelper, AppCode";
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ __InputTestTagHelper = CreateTagHelper();
+#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Date);
+
+#line default
+#line hidden
+ __InputTestTagHelper = CreateTagHelper();
+#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml"
+__InputTestTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => Model);
+
+#line default
+#line hidden
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt
new file mode 100644
index 0000000000..c4bbcf7a73
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt
new file mode 100644
index 0000000000..0a0cb62f30
--- /dev/null
+++ b/test/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: (758:19,0 [8] )
+|DateTime|
+
+Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|"InputTestTagHelper, AppCode"|
+Generated Location: (899:23,37 [29] )
+|"InputTestTagHelper, AppCode"|
+
+Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Date|
+Generated Location: (1547:36,102 [4] )
+|Date|
+
+Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml)
+|Model|
+Generated Location: (1863:42,94 [5] )
+|Model|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs
new file mode 100644
index 0000000000..b12ca26651
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs
@@ -0,0 +1,44 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable);
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt
new file mode 100644
index 0000000000..75faeeb1ca
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt
new file mode 100644
index 0000000000..226138531b
--- /dev/null
+++ b/test/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: (695:18,0 [30] )
+|System.Collections.IEnumerable|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml
new file mode 100644
index 0000000000..350f93b776
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs
new file mode 100644
index 0000000000..a766ae3900
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_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_MultipleModels_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+ThisShouldBeGenerated __typeHelper = default(ThisShouldBeGenerated);
+ }
+ ))();
+ ((System.Action)(() => {
+System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable);
+ }
+ ))();
+ }
+ #pragma warning restore 219
+ #pragma warning disable 0414
+ private static System.Object __o = null;
+ #pragma warning restore 0414
+ #pragma warning disable 1998
+ public async override global::System.Threading.Tasks.Task ExecuteAsync()
+ {
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.diagnostics.txt
new file mode 100644
index 0000000000..b051568470
--- /dev/null
+++ b/test/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 RZ9999: The 'model' directive may only occur once per document.
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt
new file mode 100644
index 0000000000..d8bb1d6d9d
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt
new file mode 100644
index 0000000000..65348abd7b
--- /dev/null
+++ b/test/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: (695:18,0 [21] )
+|ThisShouldBeGenerated|
+
+Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml)
+|System.Collections.IEnumerable|
+Generated Location: (825:22,0 [30] )
+|System.Collections.IEnumerable|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml
new file mode 100644
index 0000000000..81f73f2ca6
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml
@@ -0,0 +1,9 @@
+@{
+ Layout = "_SectionTestLayout.cshtml";
+}
+
+Some body
+
+@section Section1 {
+ This is in Section 1
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
new file mode 100644
index 0000000000..771d845938
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
@@ -0,0 +1,53 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object Section1 = null;
+ }
+ ))();
+ }
+ #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/Sections.cshtml"
+
+ Layout = "_SectionTestLayout.cshtml";
+
+#line default
+#line hidden
+ DefineSection("Section1", async(__razor_section_writer) => {
+ }
+ );
+ }
+ #pragma warning restore 1998
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
+ [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
+ public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; }
+ }
+}
+#pragma warning restore 1591
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt
new file mode 100644
index 0000000000..c4456d30ca
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt
@@ -0,0 +1,51 @@
+Document -
+ NamespaceDeclaration - - AspNetCore
+ UsingDirective - - TModel = global::System.Object
+ UsingDirective - (1:0,1 [12] ) - System
+ UsingDirective - (16:1,1 [32] ) - System.Collections.Generic
+ UsingDirective - (51:2,1 [17] ) - System.Linq
+ UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc
+ UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering
+ UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures
+ ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections_cshtml - 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 - (86:6,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
+ CSharpCode - (2:0,2 [46] Sections.cshtml)
+ IntermediateToken - (2:0,2 [46] Sections.cshtml) - CSharp - \n Layout = "_SectionTestLayout.cshtml";\n
+ HtmlContent - (51:3,0 [26] Sections.cshtml)
+ IntermediateToken - (51:3,0 [2] Sections.cshtml) - Html - \n
+ IntermediateToken - (53:4,0 [5] Sections.cshtml) - Html -
+ IntermediateToken - (58:4,5 [9] Sections.cshtml) - Html - Some body
+ IntermediateToken - (67:4,14 [6] Sections.cshtml) - Html -
+ IntermediateToken - (73:4,20 [4] Sections.cshtml) - Html - \n\n
+ Section - - Section1
+ HtmlContent - (96:6,19 [39] Sections.cshtml)
+ IntermediateToken - (96:6,19 [6] Sections.cshtml) - Html - \n
+ IntermediateToken - (102:7,4 [5] Sections.cshtml) - Html -
+ IntermediateToken - (107:7,9 [20] Sections.cshtml) - Html - This is in Section 1
+ IntermediateToken - (127:7,29 [6] Sections.cshtml) - Html -
+ IntermediateToken - (133:7,35 [2] Sections.cshtml) - Html - \n
+ Inject -
+ Inject -
+ Inject -
+ Inject -
+ Inject -
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
new file mode 100644
index 0000000000..5a6cfe78f2
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
@@ -0,0 +1,14 @@
+Source Location: (86:6,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|Section1|
+Generated Location: (697:18,22 [8] )
+|Section1|
+
+Source Location: (2:0,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
+|
+ Layout = "_SectionTestLayout.cshtml";
+|
+Generated Location: (1132:30,2 [46] )
+|
+ Layout = "_SectionTestLayout.cshtml";
+|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml
new file mode 100644
index 0000000000..0430ccfc69
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs
new file mode 100644
index 0000000000..027acd82f3
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs
@@ -0,0 +1,81 @@
+//
+#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_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ private global::AllTagHelper __AllTagHelper;
+ private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper;
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+global::System.Object __typeHelper = "*, AppCode";
+ }
+ ))();
+ }
+ #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";
+ }
+ #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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt
new file mode 100644
index 0000000000..11b8d7c99c
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_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_ViewComponentTagHelper_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage -
+ DefaultTagHelperRuntime -
+ FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper
+ FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper_cshtml.__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_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
+ 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 -
+ 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt
new file mode 100644
index 0000000000..9344e08ed2
--- /dev/null
+++ b/test/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: (973:20,37 [12] )
+|"*, AppCode"|
+
+Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml)
+|
+ var foo = "Hello";
+|
+Generated Location: (1419:32,2 [26] )
+|
+ var foo = "Hello";
+|
+
+Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml)
+|foo|
+Generated Location: (1877:40,22 [3] )
+|foo|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml
new file mode 100644
index 0000000000..f4e110d289
--- /dev/null
+++ b/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs
new file mode 100644
index 0000000000..2e09a42013
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs
@@ -0,0 +1,50 @@
+//
+#pragma warning disable 1591
+namespace AspNetCore
+{
+ #line hidden
+ using TModel = global::System.Object;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Rendering;
+ using Microsoft.AspNetCore.Mvc.ViewFeatures;
+ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage
+ {
+ #pragma warning disable 219
+ private void __RazorDirectiveTokenHelpers__() {
+ ((System.Action)(() => {
+IHtmlHelper __typeHelper = default(IHtmlHelper);
+ }
+ ))();
+ ((System.Action)(() => {
+global::System.Object Helper = null;
+ }
+ ))();
+ }
+ #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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt
new file mode 100644
index 0000000000..d2def8694a
--- /dev/null
+++ b/test/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_cshtml - 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt
new file mode 100644
index 0000000000..287d4e0c05
--- /dev/null
+++ b/test/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: (679:18,0 [19] )
+|IHtmlHelper|
+
+Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml)
+|Helper|
+Generated Location: (827:22,22 [6] )
+|Helper|
+
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/test/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/test/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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperDescriptorFactoryTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperDescriptorFactoryTest.cs
new file mode 100644
index 0000000000..d88f379542
--- /dev/null
+++ b/test/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.CaseSensitive);
+ }
+
+ [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.CaseSensitive);
+ }
+
+ [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.CaseSensitive);
+ }
+
+ [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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperDescriptorProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperDescriptorProviderTest.cs
new file mode 100644
index 0000000000..4689e7c3c5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperDescriptorProviderTest.cs
@@ -0,0 +1,75 @@
+// 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
+ {
+ private static readonly Assembly _assembly = typeof(ViewComponentTagHelperDescriptorProviderTest).GetTypeInfo().Assembly;
+
+ [Fact]
+ public void DescriptorProvider_FindsVCTH()
+ {
+ // Arrange
+ var code = @"
+ public class StringParameterViewComponent
+ {
+ public string Invoke(string foo, string bar) => null;
+ }
+";
+
+ var testCompilation = TestCompilation.Create(_assembly, CSharpSyntaxTree.ParseText(code));
+
+ var context = TagHelperDescriptorProviderContext.Create();
+ context.SetCompilation(testCompilation);
+
+ var provider = new ViewComponentTagHelperDescriptorProvider()
+ {
+ Engine = RazorEngine.CreateEmpty(b => { }),
+ ForceEnabled = true,
+ };
+
+ 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
+ var descriptor = context.Results.FirstOrDefault(d => TagHelperDescriptorComparer.CaseSensitive.Equals(d, expectedDescriptor));
+ Assert.NotNull(descriptor);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperPassTest.cs
new file mode 100644
index 0000000000..a8c4e730f0
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTagHelperPassTest.cs
@@ -0,0 +1,367 @@
+// 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.Text;
+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_cshtml.__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);
+
+ var vcthClass = Assert.IsType(@class.Children.Last());
+ var tokenNode = vcthClass.Children[0] as IntermediateToken;
+ 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);
+ }
+}
+",
+ tokenNode.Content,
+ ignoreLineEndingDifferences: true);
+ Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
+ }
+
+ [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_cshtml.__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);
+
+ var vcthClass = Assert.IsType(@class.Children[3]);
+ var tokenNode = vcthClass.Children[0] as IntermediateToken;
+ 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);
+ }
+}
+",
+ tokenNode.Content,
+ ignoreLineEndingDifferences: true);
+ Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
+ }
+
+ [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_cshtml.__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);
+
+ var vcthClass = Assert.IsType(@class.Children.Last());
+ var tokenNode = vcthClass.Children[0] as IntermediateToken;
+ 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);
+ }
+}
+",
+ tokenNode.Content,
+ ignoreLineEndingDifferences: true);
+ Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
+ }
+
+ private RazorCodeDocument CreateDocument(string content)
+ {
+ var source = RazorSourceDocument.Create(content, "test.cshtml");
+ return RazorCodeDocument.Create(source);
+ }
+
+ private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers)
+ {
+ return RazorEngine.Create(b =>
+ {
+ b.Features.Add(new MvcViewDocumentClassifierPass());
+
+ b.Features.Add(new TestTagHelperFeature(tagHelpers));
+ });
+ }
+
+ 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 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 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/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTypeVisitorTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/ViewComponentTypeVisitorTest.cs
new file mode 100644
index 0000000000..96d879756c
--- /dev/null
+++ b/test/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());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Valid_PlainViewComponent).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.True(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_DecoratedViewComponent_ReturnsTrue()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Valid_DecoratedVC).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.True(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_InheritedViewComponent_ReturnsTrue()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Valid_InheritedVC).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.True(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_AbstractViewComponent_ReturnsFalse()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_AbstractViewComponent).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.False(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_GenericViewComponent_ReturnsFalse()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_GenericViewComponent<>).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.False(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_InternalViewComponent_ReturnsFalse()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_InternalViewComponent).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.False(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_DecoratedNonViewComponent_ReturnsFalse()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_DecoratedViewComponent).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.False(isViewComponent);
+ }
+
+ [Fact]
+ public void IsViewComponent_InheritedNonViewComponent_ReturnsFalse()
+ {
+ // Arrange
+ var testVisitor = new ViewComponentTypeVisitor(
+ TestViewComponentAttributeSymbol,
+ TestNonViewComponentAttributeSymbol,
+ new List());
+ var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_InheritedViewComponent).FullName);
+
+ // Act
+ var isViewComponent = testVisitor.IsViewComponent(tagHelperSymbol);
+
+ // Assert
+ Assert.False(isViewComponent);
+ }
+
+ public abstract class Invalid_AbstractViewComponent
+ {
+ }
+
+ public class Invalid_GenericViewComponent
+ {
+ }
+
+ internal class Invalid_InternalViewComponent
+ {
+ }
+
+ public class Valid_PlainViewComponent
+ {
+ }
+
+ [TestViewComponent]
+ public class Valid_DecoratedVC
+ {
+ }
+
+ public class Valid_InheritedVC : Valid_DecoratedVC
+ {
+ }
+
+ [TestNonViewComponent]
+ public class Invalid_DecoratedViewComponent
+ {
+ }
+
+ [TestViewComponent]
+ public class Invalid_InheritedViewComponent : Invalid_DecoratedViewComponent
+ {
+ }
+
+ public class TestViewComponentAttribute : Attribute
+ {
+ }
+
+ public class TestNonViewComponentAttribute : Attribute
+ {
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/xunit.runner.json b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/xunit.runner.json
new file mode 100644
index 0000000000..fcf172c8fc
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/xunit.runner.json
@@ -0,0 +1,4 @@
+{
+ "methodDisplay": "method",
+ "shadowCopy": false
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/SectionTargetExtensionTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/SectionTargetExtensionTest.cs
index 991fcce28e..c369432e3b 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/SectionTargetExtensionTest.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/SectionTargetExtensionTest.cs
@@ -3,9 +3,7 @@
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
using Xunit;
-using static Microsoft.AspNetCore.Razor.Language.Intermediate.IntermediateNodeAssert;
namespace Microsoft.AspNetCore.Razor.Language.Extensions
{
@@ -69,7 +67,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
extension.WriteSection(context, node);
// Assert
- var expected = @"CreateSection(""MySection"", async(__razor_section_writer) => {
+ var expected = @"CreateSection(""MySection"", async() => {
Render Children
}
);
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs
index d30aea4b02..0897ae157d 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs
@@ -53,7 +53,7 @@ __o = Foo(item => new Template(async(__razor_template_writer) => {
#line default
#line hidden
- DefineSection("Footer", async(__razor_section_writer) => {
+ DefineSection("Footer", async() => {
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml"
__o = bar;
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt
index 87ab943dfc..a72db81cb6 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt
@@ -44,6 +44,6 @@ Generated Location: (1636:51,1 [1] )
Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml)
|bar|
-Generated Location: (1836:57,6 [3] )
+Generated Location: (1814:57,6 [3] )
|bar|
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
index 556cf5e489..b610f02553 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs
@@ -33,7 +33,7 @@ global::System.Object NestedDelegates = null;
#line default
#line hidden
- DefineSection("Section2", async(__razor_section_writer) => {
+ DefineSection("Section2", async() => {
#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
__o = thing;
@@ -41,10 +41,10 @@ global::System.Object NestedDelegates = null;
#line hidden
}
);
- DefineSection("Section1", async(__razor_section_writer) => {
+ DefineSection("Section1", async() => {
}
);
- DefineSection("NestedDelegates", async(__razor_section_writer) => {
+ DefineSection("NestedDelegates", async() => {
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
Func f =
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
index f6aedef836..ff1262a84a 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt
@@ -24,21 +24,21 @@ Generated Location: (1024:30,2 [44] )
Source Location: (123:7,22 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|thing|
-Generated Location: (1279:37,22 [5] )
+Generated Location: (1257:37,22 [5] )
|thing|
Source Location: (260:15,6 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
| Func f = |
-Generated Location: (1626:48,6 [27] )
+Generated Location: (1560:48,6 [27] )
| Func f = |
Source Location: (295:15,41 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|item|
-Generated Location: (1886:54,41 [4] )
+Generated Location: (1820:54,41 [4] )
|item|
Source Location: (306:15,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|; |
-Generated Location: (2099:61,52 [2] )
+Generated Location: (2033:61,52 [2] )
|; |
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs
index e1a96c0d30..49a1737a04 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs
@@ -23,10 +23,10 @@ global::System.Object WriteLiteralsToInHereAlso = null;
#pragma warning disable 1998
public async System.Threading.Tasks.Task ExecuteAsync()
{
- DefineSection("WriteLiteralsToInHere", async(__razor_section_writer) => {
+ DefineSection("WriteLiteralsToInHere", async() => {
}
);
- DefineSection("WriteLiteralsToInHereAlso", async(__razor_section_writer) => {
+ DefineSection("WriteLiteralsToInHereAlso", async() => {
}
);
}
diff --git a/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/HelperResult.cs b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/HelperResult.cs
new file mode 100644
index 0000000000..094a762152
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/HelperResult.cs
@@ -0,0 +1,22 @@
+// 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.IO;
+using System.Text.Encodings.Web;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
+
+namespace Microsoft.AspNetCore.Mvc.Razor
+{
+ public class HelperResult : IHtmlContent
+ {
+ public HelperResult(Func asyncAction)
+ {
+ }
+
+ public void WriteTo(TextWriter writer, HtmlEncoder encoder)
+ {
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/IRazorPage.cs b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/IRazorPage.cs
new file mode 100644
index 0000000000..34a1b208da
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/IRazorPage.cs
@@ -0,0 +1,31 @@
+// 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.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
+using Microsoft.AspNetCore.Mvc.Rendering;
+
+namespace Microsoft.AspNetCore.Mvc.Razor
+{
+ public interface IRazorPage
+ {
+ ViewContext ViewContext { get; set; }
+
+ IHtmlContent BodyContent { get; set; }
+
+ bool IsLayoutBeingRendered { get; set; }
+
+ string Path { get; set; }
+
+ string Layout { get; set; }
+
+ IDictionary PreviousSectionWriters { get; set; }
+
+ IDictionary SectionWriters { get; }
+
+ Task ExecuteAsync();
+
+ void EnsureRenderedBodyOrSections();
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorInjectAttribute.cs b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorInjectAttribute.cs
new file mode 100644
index 0000000000..321129faea
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorInjectAttribute.cs
@@ -0,0 +1,14 @@
+// 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;
+
+namespace Microsoft.AspNetCore.Mvc.Razor.Internal
+{
+ public class RazorInjectAttribute : Attribute
+ {
+ public RazorInjectAttribute ()
+ {
+ }
+ }
+}
diff --git a/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorPage.cs b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorPage.cs
new file mode 100644
index 0000000000..b47d37d067
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X/Microsoft.AspNetCore.Mvc.Razor/RazorPage.cs
@@ -0,0 +1,55 @@
+// 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.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.AspNetCore.Razor.TagHelpers;
+
+namespace Microsoft.AspNetCore.Mvc.Razor
+{
+ public abstract class RazorPage : IRazorPage
+ {
+ public ViewContext ViewContext { get; set; }
+
+ public IHtmlContent BodyContent { get; set; }
+
+ public bool IsLayoutBeingRendered { get; set; }
+
+ public string Path { get; set; }
+
+ public string Layout { get; set; }
+
+ public IDictionary PreviousSectionWriters { get; set; }
+
+ public IDictionary