+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html
new file mode 100644
index 0000000000..52fe51a130
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html
new file mode 100644
index 0000000000..5b456be824
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html
new file mode 100644
index 0000000000..835b3a68ca
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html
@@ -0,0 +1,2 @@
+
+
Hi There!
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html
new file mode 100644
index 0000000000..262e601e9c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs
index f09c68069a..5206b7b45c 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpLoweringPhase.cs
@@ -2,7 +2,6 @@
// 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 Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs
new file mode 100644
index 0000000000..82de883267
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorHtmlDocument.cs
@@ -0,0 +1,35 @@
+// 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.Razor.Language
+{
+ internal class DefaultRazorHtmlDocument : RazorHtmlDocument
+ {
+ private readonly string _generatedHtml;
+ private readonly RazorCodeGenerationOptions _options;
+
+ public DefaultRazorHtmlDocument(
+ string generatedHtml,
+ RazorCodeGenerationOptions options)
+ {
+ if (generatedHtml == null)
+ {
+ throw new ArgumentNullException(nameof(generatedHtml));
+ }
+
+ if (options == null)
+ {
+ throw new ArgumentNullException(nameof(options));
+ }
+
+ _generatedHtml = generatedHtml;
+ _options = options;
+ }
+
+ public override string GeneratedHtml => _generatedHtml;
+
+ public override RazorCodeGenerationOptions Options => _options;
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs
index e9982aa2c5..9a0f8c1bc3 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorTagHelperBinderPhase.cs
@@ -102,8 +102,6 @@ namespace Microsoft.AspNetCore.Razor.Language
return string.Equals(descriptor.Name, typePattern, StringComparison.Ordinal);
}
-
-
internal abstract class DirectiveVisitor : SyntaxWalker
{
public abstract HashSet Matches { get; }
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs
index 704a9da482..e968b1d6de 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeDocumentExtensions.cs
@@ -3,9 +3,6 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
@@ -118,6 +115,25 @@ namespace Microsoft.AspNetCore.Razor.Language
document.Items[typeof(DocumentIntermediateNode)] = documentNode;
}
+ internal static RazorHtmlDocument GetHtmlDocument(this RazorCodeDocument document)
+ {
+ if (document == null)
+ {
+ throw new ArgumentNullException(nameof(document));
+ }
+
+ var razorHtmlObj = document.Items[typeof(RazorHtmlDocument)];
+ if (razorHtmlObj == null)
+ {
+ var razorHtmlDocument = RazorHtmlWriter.GetHtmlDocument(document);
+ document.Items[typeof(RazorHtmlDocument)] = razorHtmlDocument;
+
+ return razorHtmlDocument;
+ }
+
+ return (RazorHtmlDocument)razorHtmlObj;
+ }
+
public static RazorCSharpDocument GetCSharpDocument(this RazorCodeDocument document)
{
if (document == null)
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs
index cb8a10389a..864c5c2da5 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorEngine.cs
@@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{
#pragma warning disable CS0618 // Type or member is obsolete
private static RazorEngine CreateCore(RazorConfiguration configuration, bool designTime, Action configure)
-#pragma warning disable CS0618 // Type or member is obsolete
+#pragma warning restore CS0618 // Type or member is obsolete
{
if (configuration == null)
{
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs
new file mode 100644
index 0000000000..2f14695577
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs
@@ -0,0 +1,29 @@
+// 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.Razor.Language
+{
+ internal abstract class RazorHtmlDocument
+ {
+ public abstract string GeneratedHtml { get; }
+
+ public abstract RazorCodeGenerationOptions Options { get; }
+
+ public static RazorHtmlDocument Create(string generatedHtml, RazorCodeGenerationOptions options)
+ {
+ if (generatedHtml == null)
+ {
+ throw new ArgumentNullException(nameof(generatedHtml));
+ }
+
+ if (options == null)
+ {
+ throw new ArgumentNullException(nameof(options));
+ }
+
+ return new DefaultRazorHtmlDocument(generatedHtml, options);
+ }
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs
new file mode 100644
index 0000000000..6d29531efb
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlWriter.cs
@@ -0,0 +1,166 @@
+// 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.Diagnostics;
+using System.Text;
+using Microsoft.AspNetCore.Razor.Language.Syntax;
+
+namespace Microsoft.AspNetCore.Razor.Language
+{
+ // We want to generate a HTML document that contains only pure HTML.
+ // So we want replace all non-HTML content with whitespace.
+ // Ideally we should just use ClassifiedSpans to generate this document but
+ // not all characters in the document are included in the ClassifiedSpans.
+ internal class RazorHtmlWriter : SyntaxWalker
+ {
+ private bool _isHtml;
+
+ private RazorHtmlWriter(RazorSourceDocument source)
+ {
+ if (source is null)
+ {
+ throw new ArgumentNullException(nameof(source));
+ }
+
+ Source = source;
+ Builder = new StringBuilder(Source.Length);
+ _isHtml = true;
+ }
+
+ public RazorSourceDocument Source { get; }
+
+ public StringBuilder Builder { get; }
+
+ public static RazorHtmlDocument GetHtmlDocument(RazorCodeDocument codeDocument)
+ {
+ var options = codeDocument.GetCodeGenerationOptions();
+ if (options == null || !options.DesignTime)
+ {
+ // Not needed in run time. This pass generates the backing HTML document that is used to provide HTML intellisense.
+ return null;
+ }
+
+ var writer = new RazorHtmlWriter(codeDocument.Source);
+ var syntaxTree = codeDocument.GetSyntaxTree();
+
+ writer.Visit(syntaxTree.Root);
+
+ var generatedHtml = writer.Builder.ToString();
+ Debug.Assert(
+ writer.Source.Length == writer.Builder.Length,
+ $"The backing HTML document should be the same length as the original document. Expected: {writer.Source.Length} Actual: {writer.Builder.Length}");
+
+ var razorHtmlDocument = new DefaultRazorHtmlDocument(generatedHtml, options);
+ return razorHtmlDocument;
+ }
+
+ public override void VisitRazorCommentBlock(RazorCommentBlockSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitRazorCommentBlock);
+ }
+
+ public override void VisitRazorMetaCode(RazorMetaCodeSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitRazorMetaCode);
+ }
+
+ public override void VisitMarkupTransition(MarkupTransitionSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitMarkupTransition);
+ }
+
+ public override void VisitCSharpTransition(CSharpTransitionSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitCSharpTransition);
+ }
+
+ public override void VisitCSharpEphemeralTextLiteral(CSharpEphemeralTextLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitCSharpEphemeralTextLiteral);
+ }
+
+ public override void VisitCSharpExpressionLiteral(CSharpExpressionLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitCSharpExpressionLiteral);
+ }
+
+ public override void VisitCSharpStatementLiteral(CSharpStatementLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: false, base.VisitCSharpStatementLiteral);
+ }
+
+ public override void VisitMarkupStartTag(MarkupStartTagSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupStartTag);
+ }
+
+ public override void VisitMarkupEndTag(MarkupEndTagSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupEndTag);
+ }
+
+ public override void VisitMarkupTagHelperStartTag(MarkupTagHelperStartTagSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupTagHelperStartTag);
+ }
+
+ public override void VisitMarkupTagHelperEndTag(MarkupTagHelperEndTagSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupTagHelperEndTag);
+ }
+
+ public override void VisitMarkupEphemeralTextLiteral(MarkupEphemeralTextLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupEphemeralTextLiteral);
+ }
+
+ public override void VisitMarkupTextLiteral(MarkupTextLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitMarkupTextLiteral);
+ }
+
+ public override void VisitUnclassifiedTextLiteral(UnclassifiedTextLiteralSyntax node)
+ {
+ WriteNode(node, isHtml: true, base.VisitUnclassifiedTextLiteral);
+ }
+
+ public override void VisitToken(SyntaxToken token)
+ {
+ base.VisitToken(token);
+ WriteToken(token);
+ }
+
+ private void WriteToken(SyntaxToken token)
+ {
+ var content = token.Content;
+ if (_isHtml)
+ {
+ // If we're in HTML context, append the content directly.
+ Builder.Append(content);
+ return;
+ }
+
+ // We're in non-HTML context. Let's replace all non-whitespace chars with a space.
+ foreach (var c in content)
+ {
+ if (char.IsWhiteSpace(c))
+ {
+ Builder.Append(c);
+ }
+ else
+ {
+ Builder.Append(' ');
+ }
+ }
+ }
+
+ private void WriteNode(TNode node, bool isHtml, Action handler) where TNode : SyntaxNode
+ {
+ var old = _isHtml;
+ _isHtml = isHtml;
+ handler(node);
+ _isHtml = old;
+ }
+ }
+}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs
index 22133be03f..175c69abf6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs
@@ -1001,6 +1001,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
// Assert
AssertDocumentNodeMatchesBaseline(codeDocument.GetDocumentIntermediateNode());
+ AssertHtmlDocumentMatchesBaseline(codeDocument.GetHtmlDocument());
AssertCSharpDocumentMatchesBaseline(codeDocument.GetCSharpDocument());
AssertSourceMappingsMatchBaseline(codeDocument);
AssertLinePragmas(codeDocument, designTime: true);
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs
index 576c3cc448..c9fa4504cd 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorProjectEngineTest.cs
@@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Razor.Language
feature => Assert.IsType(feature),
feature => Assert.IsType(feature),
feature => Assert.IsType(feature),
- feature => Assert.IsType(feature),
+ feature => Assert.IsType(feature),
feature => Assert.IsType(feature));
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html
new file mode 100644
index 0000000000..0da46f2152
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html
@@ -0,0 +1 @@
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html
new file mode 100644
index 0000000000..fd82d19806
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+Hello World
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html
new file mode 100644
index 0000000000..22593ca1ef
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
Basic Asynchronous Expression Test
+
Basic Asynchronous Expression:
+
Basic Asynchronous Template:
+
Basic Asynchronous Statement:
+
Basic Asynchronous Statement Nested:
+
Basic Incomplete Asynchronous Statement:
+
+
+
+
Advanced Asynchronous Expression Test
+
Advanced Asynchronous Expression:
+
Advanced Asynchronous Expression Extended:
+
Advanced Asynchronous Template:
+
Advanced Asynchronous Statement:
+
Advanced Asynchronous Statement Extended:
+
Advanced Asynchronous Statement Nested:
+
Advanced Incomplete Asynchronous Statement:
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html
new file mode 100644
index 0000000000..dc08c79219
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
Hello from C#, #
+
+
+
+
+
We wrote 10 lines!
+
+
+
+
+
No really, we wrote 10 lines!
+
+
+
Actually, we didn't...
+
+
+
+
+
Hello again from C#, #
+
+
+
+
That time, we wrote 5 lines!
+
+
Oh no! An error occurred:
+
+
+
i is now
+
+
+
This block is locked, for your security!
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html
new file mode 100644
index 0000000000..a2aad32abe
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Here's a very unique number:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html
new file mode 100644
index 0000000000..2e0ee4dc6e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html
new file mode 100644
index 0000000000..136d06384a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html
new file mode 100644
index 0000000000..a6e01f1a0e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html
@@ -0,0 +1,4 @@
+
+ foo
+ bar
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html
new file mode 100644
index 0000000000..f857199dcf
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html
new file mode 100644
index 0000000000..46a4402680
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html
new file mode 100644
index 0000000000..be5ba4979a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html
@@ -0,0 +1,15 @@
+
+
+
This is item #
+
+
+
+
+
+
Bar Biz
+
+
+
+
Foo
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html
new file mode 100644
index 0000000000..9ebe0e3a78
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+This is markup
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html
new file mode 100644
index 0000000000..9ebe0e3a78
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+This is markup
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html
new file mode 100644
index 0000000000..1568f6aa34
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html
new file mode 100644
index 0000000000..76ee36910b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+This is markup
+
+ !
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html
new file mode 100644
index 0000000000..6eaf3f7aa0
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+This is markup
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html
new file mode 100644
index 0000000000..fc59317849
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html
new file mode 100644
index 0000000000..33b749a2f9
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html
@@ -0,0 +1 @@
+1 + 1 =
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html
new file mode 100644
index 0000000000..de86958add
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
Foo is Null!
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html
new file mode 100644
index 0000000000..6393f9703b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html
new file mode 100644
index 0000000000..46d84b460b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+Here's a random number:
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html
new file mode 100644
index 0000000000..13484a1b45
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html
new file mode 100644
index 0000000000..21fdc4d316
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html
new file mode 100644
index 0000000000..1c32421c7e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html
new file mode 100644
index 0000000000..d0776340e1
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html
new file mode 100644
index 0000000000..f1c2edafa2
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+This is markup
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html
new file mode 100644
index 0000000000..c3ca733a2b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+
+
This is item #
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html
new file mode 100644
index 0000000000..b7d08f3856
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html
new file mode 100644
index 0000000000..b60ac0100e
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html
new file mode 100644
index 0000000000..3b6fa1cd06
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+ (string link) {
+
+}
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html
new file mode 100644
index 0000000000..111d1f7474
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html
@@ -0,0 +1,38 @@
+
+
+
Bar
+ Hello, World
+
Hello, World
+
+
+
+
Hello from C#, #
+
+
+
+
+
We wrote 10 lines!
+
+
+
+
+
No really, we wrote 10 lines!
+
+
+
Actually, we didn't...
+
+
+
+
+
Hello again from C#, #
+
+
+
+
That time, we wrote 5 lines!
+
+
Oh no! An error occurred:
+
+
+
+
This block is locked, for your security!
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html
new file mode 100644
index 0000000000..9148ce7323
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html
@@ -0,0 +1,5 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html
new file mode 100644
index 0000000000..11a63ced54
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.html
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html
new file mode 100644
index 0000000000..3d06dc8b90
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.html
@@ -0,0 +1,102 @@
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html
new file mode 100644
index 0000000000..b47c6a931c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.html
@@ -0,0 +1,237 @@
+
This is line 1
+
This is line 2
+
This is line 3
+
This is line 4
+
This is line 5
+
This is line 6
+
This is line 7
+
This is line 8
+
This is line 9
+
This is line 10
+
This is line 11
+
This is line 12
+
This is line 13
+
This is line 14
+
This is line 15
+
This is line 16
+
This is line 17
+
This is line 18
+
This is line 19
+
This is line 20
+
This is line 21
+
This is line 22
+
This is line 23
+
This is line 24
+
This is line 25
+
This is line 26
+
This is line 27
+
This is line 28
+
This is line 29
+
This is line 30
+
This is line 31
+
This is line 32
+
This is line 33
+
This is line 34
+
This is line 35
+
This is line 36
+
This is line 37
+
This is line 38
+
This is line 39
+
This is line 40
+
This is line 41
+
This is line 42
+
This is line 43
+
This is line 44
+
This is line 45
+
This is line 46
+
This is line 47
+
This is line 48
+
This is line 49
+
This is line 50
+
This is line 51
+
This is line 52
+
This is line 53
+
This is line 54
+
This is line 55
+
This is line 56
+
This is line 57
+
This is line 58
+
This is line 59
+
This is line 60
+
This is line 61
+
This is line 62
+
This is line 63
+
This is line 64
+
This is line 65
+
This is line 66
+
This is line 67
+
This is line 68
+
This is line 69
+
This is line 70
+
This is line 71
+
This is line 72
+
This is line 73
+
This is line 74
+
This is line 75
+
This is line 76
+
This is line 77
+
This is line 78
+
This is line 79
+
This is line 80
+
This is line 81
+
This is line 82
+
This is line 83
+
This is line 84
+
+
+
This is line 1 nested
+
This is line 2 nested
+
This is line 3 nested
+
This is line 4 nested
+
This is line 5 nested
+
This is line 6 nested
+
This is line 7 nested
+
This is line 8 nested
+
This is line 9 nested
+
This is line 10 nested
+
This is line 11 nested
+
This is line 12 nested
+
This is line 13 nested
+
This is line 14 nested
+
This is line 15 nested
+
This is line 16 nested
+
This is line 17 nested
+
This is line 18 nested
+
This is line 19 nested
+
This is line 20 nested
+
This is line 21 nested
+
This is line 22 nested
+
This is line 23 nested
+
This is line 24 nested
+
This is line 25 nested
+
This is line 26 nested
+
This is line 27 nested
+
This is line 28 nested
+
This is line 29 nested
+
This is line 30 nested
+
This is line 31 nested
+
This is line 32 nested
+
This is line 33 nested
+
This is line 34 nested
+
This is line 35 nested
+
This is line 36 nested
+
This is line 37 nested
+
This is line 38 nested
+
This is line 39 nested
+
This is line 40 nested
+
This is line 41 nested
+
This is line 42 nested
+
This is line 43 nested
+
This is line 44 nested
+
This is line 45 nested
+
This is line 46 nested
+
This is line 47 nested
+
This is line 48 nested
+
This is line 49 nested
+
This is line 50 nested
+
This is line 51 nested
+
This is line 52 nested
+
This is line 53 nested
+
This is line 54 nested
+
This is line 55 nested
+
This is line 56 nested
+
This is line 57 nested
+
This is line 58 nested
+
This is line 59 nested
+
This is line 60 nested
+
This is line 61 nested
+
This is line 62 nested
+
This is line 63 nested
+
This is line 64 nested
+
This is line 65 nested
+
This is line 66 nested
+
This is line 67 nested
+
This is line 68 nested
+
This is line 69 nested
+
This is line 70 nested
+
This is line 71 nested
+
This is line 72 nested
+
This is line 73 nested
+
This is line 74 nested
+
This is line 75 nested
+
+
This is line 1
+
This is line 2
+
This is line 3
+
This is line 4
+
This is line 5
+
This is line 6
+
This is line 7
+
This is line 8
+
This is line 9
+
This is line 10
+
This is line 11
+
This is line 12
+
This is line 13
+
This is line 14
+
This is line 15
+
This is line 16
+
This is line 17
+
This is line 18
+
This is line 19
+
This is line 20
+
This is line 21
+
This is line 22
+
This is line 23
+
This is line 24
+
This is line 25
+
This is line 26
+
This is line 27
+
This is line 28
+
This is line 29
+
This is line 30
+
This is line 31
+
This is line 32
+
This is line 33
+
This is line 34
+
This is line 35
+
This is line 36
+
This is line 37
+
This is line 38
+
This is line 39
+
This is line 40
+
This is line 41
+
This is line 42
+
This is line 43
hi!
+
+
This is line 1 nested
+
This is line 2 nested
+
This is line 3 nested
+
This is line 4 nested
+
This is line 5 nested
+
This is line 6 nested
+
This is line 7 nested
+
This is line 8 nested
+
This is line 9 nested
+
This is line 10 nested
+
This is line 11 nested
+
This is line 12 nested
+
This is line 13 nested
+
This is line 14 nested
+
This is line 15 nested
+
This is line 16 nested
+
This is line 17 nested
+
This is line 18 nested
+
This is line 19 nested
+
This is line 20 nested
+
This is line 21 nested
+
This is line 22 nested
+
This is line 23 nested
+
This is line 24 nested
+
This is line 25 nested
+
This is line 26 nested
+
This is line 27 nested
+
This is line 28 nested
+
This is line 29 nested
+
30
+ !
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html
new file mode 100644
index 0000000000..419c13c11c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+This works !
+
+
+
+
+
Hello
+
+
+
+
+
Item #
+
+
+
+
+ This is line# of markup
+
+
+
+
+
+ : This is line# of markup
+
+
+
+
+
+ :: This is line# of markup
+
+
+
+
+
+
+ Item #
+
+
+
Child Items... ?
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html
new file mode 100644
index 0000000000..ae3e23d828
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html
new file mode 100644
index 0000000000..d16439d975
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Path's full type name is
+
Foo's actual full type name is
\ No newline at end of file
diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
index 84ed8ac87f..1f50719819 100644
--- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
+++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs
@@ -361,6 +361,36 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
IntermediateNodeVerifier.Verify(document, baseline);
}
+ internal void AssertHtmlDocumentMatchesBaseline(RazorHtmlDocument htmlDocument)
+ {
+ if (FileName == null)
+ {
+ var message = $"{nameof(AssertHtmlDocumentMatchesBaseline)} should only be called from an integration test ({nameof(FileName)} is null).";
+ throw new InvalidOperationException(message);
+ }
+
+ var baselineFileName = Path.ChangeExtension(FileName, ".codegen.html");
+
+ if (GenerateBaselines)
+ {
+ var baselineFullPath = Path.Combine(TestProjectRoot, baselineFileName);
+ File.WriteAllText(baselineFullPath, htmlDocument.GeneratedHtml);
+ return;
+ }
+
+ var htmlFile = TestFile.Create(baselineFileName, GetType().GetTypeInfo().Assembly);
+ if (!htmlFile.Exists())
+ {
+ throw new XunitException($"The resource {baselineFileName} was not found.");
+ }
+
+ var baseline = htmlFile.ReadAllText();
+
+ // Normalize newlines to match those in the baseline.
+ var actual = htmlDocument.GeneratedHtml.Replace("\r", "").Replace("\n", "\r\n");
+ Assert.Equal(baseline, actual);
+ }
+
protected void AssertCSharpDocumentMatchesBaseline(RazorCSharpDocument cSharpDocument)
{
if (FileName == null)