diff --git a/eng/Versions.props b/eng/Versions.props
index 52d9e915a379..25d4cc009036 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -158,8 +158,6 @@
$(MicrosoftNETCoreAppRuntimewinx64Version)
-
- 3.10.0-1.final
5.0.0-preview.4.20180.4
@@ -190,8 +188,8 @@
16.9.0
1.2.6
16.9.0
- 3.8.0
- 3.8.0
+ 4.0.0-2.21354.7
+ 4.0.0-2.21354.7
3.8.0
3.3.0
1.0.0-20200708.1
diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs
index c3df65cf639e..f24a8d773a76 100644
--- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.codegen.cs
@@ -25,15 +25,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
);
__builder.AddMarkupContent(2, "\r\n Hello world\r\n ");
- __builder.AddContent(3,
#nullable restore
-#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml"
- string.Format("{0}", "Hello")
+#line (4,6)-(4,35) 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent.cshtml"
+__builder.AddContent(3, string.Format("{0}", "Hello"));
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
}
#pragma warning restore 1998
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs
index 52391af09061..734cfa49d719 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs
@@ -145,6 +145,27 @@ public static CodeWriter WriteUsing(this CodeWriter writer, string name, bool en
return writer;
}
+ public static CodeWriter WriteEnhancedLineNumberDirective(this CodeWriter writer, SourceSpan span, int characterOffset)
+ {
+ // All values here need to be offset by 1 since #line uses a 1-indexed numbering system.
+ var lineNumberAsString = (span.LineIndex + 1).ToString(CultureInfo.InvariantCulture);
+ var characterStartAsString = (span.CharacterIndex + 1).ToString(CultureInfo.InvariantCulture);
+ var lineEndAsString = (span.LineIndex + 1 + span.LineCount).ToString(CultureInfo.InvariantCulture);
+ var characterEndAsString = (span.EndCharacterIndex + 1).ToString(CultureInfo.InvariantCulture);
+ var characterOffsetAsString = characterOffset.ToString(CultureInfo.InvariantCulture);
+ return writer.Write("#line (")
+ .Write(lineNumberAsString)
+ .Write(",")
+ .Write(characterStartAsString)
+ .Write(")-(")
+ .Write(lineEndAsString)
+ .Write(",")
+ .Write(characterEndAsString)
+ .Write(") ")
+ .Write(characterOffsetAsString)
+ .Write(" \"").Write(span.FilePath).WriteLine("\"");
+ }
+
public static CodeWriter WriteLineNumberDirective(this CodeWriter writer, SourceSpan span)
{
if (writer.Length >= writer.NewLine.Length && !IsAtBeginningOfLine(writer))
@@ -462,7 +483,18 @@ public static IDisposable BuildLinePragma(this CodeWriter writer, SourceSpan? sp
return NullDisposable.Default;
}
- return new LinePragmaWriter(writer, span.Value, context);
+ return new LinePragmaWriter(writer, span.Value, context, 0, false);
+ }
+
+ public static IDisposable BuildEnhancedLinePragma(this CodeWriter writer, SourceSpan? span, CodeRenderingContext context, int characterOffset = 0)
+ {
+ if (string.IsNullOrEmpty(span?.FilePath))
+ {
+ // Can't build a valid line pragma without a file path.
+ return NullDisposable.Default;
+ }
+
+ return new LinePragmaWriter(writer, span.Value, context, characterOffset, useEnhancedLinePragma: true);
}
private static void WriteVerbatimStringLiteral(CodeWriter writer, string literal)
@@ -619,7 +651,9 @@ private class LinePragmaWriter : IDisposable
public LinePragmaWriter(
CodeWriter writer,
SourceSpan span,
- CodeRenderingContext context)
+ CodeRenderingContext context,
+ int characterOffset,
+ bool useEnhancedLinePragma = false)
{
if (writer == null)
{
@@ -643,7 +677,15 @@ public LinePragmaWriter(
_writer.WriteLine("#nullable restore");
}
- WriteLineNumberDirective(writer, span);
+ if (useEnhancedLinePragma && _context.Options.UseEnhancedLinePragma)
+ {
+ WriteEnhancedLineNumberDirective(writer, span, characterOffset);
+ }
+ else
+ {
+ WriteLineNumberDirective(writer, span);
+ }
+
// Capture the line index after writing the #line directive.
_startLineIndex = writer.Location.LineIndex;
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs
index 70ce09875832..8344b412adfd 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/LinePragma.cs
@@ -10,6 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
public readonly struct LinePragma : IEquatable
{
public LinePragma(int startLineIndex, int lineCount, string filePath)
+ : this(startLineIndex: startLineIndex, lineCount: lineCount, filePath: filePath, startCharacterIndex: null, endCharacterIndex: null, characterOffset: null)
+ {
+ }
+
+ public LinePragma(int startLineIndex, int lineCount, string filePath, int? startCharacterIndex, int? endCharacterIndex, int? characterOffset)
{
if (startLineIndex < 0)
{
@@ -24,6 +29,9 @@ public LinePragma(int startLineIndex, int lineCount, string filePath)
StartLineIndex = startLineIndex;
LineCount = lineCount;
FilePath = filePath;
+ StartCharacterIndex = startCharacterIndex;
+ EndCharacterIndex = endCharacterIndex;
+ CharacterOffset = characterOffset;
}
public int StartLineIndex { get; }
@@ -32,6 +40,12 @@ public LinePragma(int startLineIndex, int lineCount, string filePath)
public int LineCount { get; }
+ public int? StartCharacterIndex { get; }
+
+ public int? EndCharacterIndex { get; }
+
+ public int? CharacterOffset { get; }
+
public string FilePath { get; }
public override bool Equals(object obj)
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs
index 28a08feb6b2f..14a2519255d1 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentRuntimeNodeWriter.cs
@@ -96,27 +96,33 @@ public override void WriteCSharpExpression(CodeRenderingContext context, CSharpE
throw new ArgumentNullException(nameof(node));
}
- // Since we're not in the middle of writing an element, this must evaluate as some
- // text to display
- context.CodeWriter
- .WriteStartMethodInvocation($"{_scopeStack.BuilderVarName}.{ComponentsApi.RenderTreeBuilder.AddContent}")
- .Write((_sourceSequence++).ToString(CultureInfo.InvariantCulture))
- .WriteParameterSeparator();
+ var sourceSequenceAsString = _sourceSequence.ToString(CultureInfo.InvariantCulture);
+ var methodInvocation = _scopeStack.BuilderVarName + '.' + ComponentsApi.RenderTreeBuilder.AddContent +'(' + sourceSequenceAsString;
+ _sourceSequence++;
+ var parameterSeparatorLength = 2;
- for (var i = 0; i < node.Children.Count; i++)
+ using (context.CodeWriter.BuildEnhancedLinePragma(node.Source.Value, context, methodInvocation.Length + parameterSeparatorLength))
{
- if (node.Children[i] is IntermediateToken token && token.IsCSharp)
- {
- WriteCSharpToken(context, token);
- }
- else
+ // Since we're not in the middle of writing an element, this must evaluate as some
+ // text to display
+ context.CodeWriter
+ .Write(methodInvocation)
+ .WriteParameterSeparator();
+
+ for (var i = 0; i < node.Children.Count; i++)
{
- // There may be something else inside the expression like a Template or another extension node.
- context.RenderNode(node.Children[i]);
+ if (node.Children[i] is IntermediateToken token && token.IsCSharp)
+ {
+ WriteCSharpToken(context, token, includeLinePragma: false);
+ }
+ else
+ {
+ // There may be something else inside the expression like a Template or another extension node.
+ context.RenderNode(node.Children[i]);
+ }
}
+ context.CodeWriter.WriteEndMethodInvocation();
}
-
- context.CodeWriter.WriteEndMethodInvocation();
}
public override void WriteCSharpExpressionAttributeValue(CodeRenderingContext context, CSharpExpressionAttributeValueIntermediateNode node)
@@ -1030,7 +1036,7 @@ private static void WriteAttributeValue(CodeRenderingContext context, IList
// Prefix= (space)
@@ -1446,7 +1454,9 @@ public override void VisitCSharpTemplateBlock(CSharpTemplateBlockSyntax node)
sourceRangeStart.Value.AbsoluteIndex,
sourceRangeStart.Value.LineIndex,
sourceRangeStart.Value.CharacterIndex,
- contentLength);
+ contentLength,
+ sourceRangeStart.Value.LineCount,
+ sourceRangeStart.Value.EndCharacterIndex);
}
}
}
@@ -1505,7 +1515,9 @@ public override void VisitCSharpExplicitExpression(CSharpExplicitExpressionSynta
sourceRangeStart.Value.AbsoluteIndex,
sourceRangeStart.Value.LineIndex,
sourceRangeStart.Value.CharacterIndex,
- contentLength);
+ contentLength,
+ sourceRangeStart.Value.LineCount,
+ sourceRangeStart.Value.EndCharacterIndex);
}
}
}
@@ -1558,7 +1570,9 @@ public override void VisitCSharpImplicitExpression(CSharpImplicitExpressionSynta
sourceRangeStart.Value.AbsoluteIndex,
sourceRangeStart.Value.LineIndex,
sourceRangeStart.Value.CharacterIndex,
- contentLength);
+ contentLength,
+ sourceRangeStart.Value.LineCount,
+ sourceRangeStart.Value.EndCharacterIndex);
}
}
}
@@ -2059,7 +2073,9 @@ private void Combine(HtmlContentIntermediateNode node, SyntaxNode item)
node.Source.Value.AbsoluteIndex,
node.Source.Value.LineIndex,
node.Source.Value.CharacterIndex,
- node.Source.Value.Length + item.FullWidth);
+ node.Source.Value.Length + item.FullWidth,
+ node.Source.Value.LineCount,
+ node.Source.Value.EndCharacterIndex);
}
}
@@ -2163,7 +2179,9 @@ public override void VisitCSharpImplicitExpression(CSharpImplicitExpressionSynta
sourceRangeStart.Value.AbsoluteIndex,
sourceRangeStart.Value.LineIndex,
sourceRangeStart.Value.CharacterIndex,
- contentLength);
+ contentLength,
+ sourceRangeStart.Value.LineCount,
+ sourceRangeStart.Value.EndCharacterIndex);
}
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt
index d117adf7a59e..40dcc244098e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt
@@ -19,3 +19,13 @@ abstract Microsoft.AspNetCore.Razor.Language.RazorConfiguration.UseConsolidatedM
~static Microsoft.AspNetCore.Razor.Language.DirectiveDescriptorBuilderExtensions.AddOptionalGenericTypeConstraintToken(this Microsoft.AspNetCore.Razor.Language.IDirectiveDescriptorBuilder builder, string name, string description) -> Microsoft.AspNetCore.Razor.Language.IDirectiveDescriptorBuilder
~static Microsoft.AspNetCore.Razor.Language.RazorConfiguration.Create(Microsoft.AspNetCore.Razor.Language.RazorLanguageVersion languageVersion, string configurationName, System.Collections.Generic.IEnumerable extensions, bool useConsolidatedMvcViews = false) -> Microsoft.AspNetCore.Razor.Language.RazorConfiguration
~static readonly Microsoft.AspNetCore.Razor.Language.RazorLanguageVersion.Version_6_0 -> Microsoft.AspNetCore.Razor.Language.RazorLanguageVersion
+~Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma.LinePragma(int startLineIndex, int lineCount, string filePath, int? startCharacterIndex, int? endCharacterIndex, int? characterOffset) -> void
+Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma.StartCharacterIndex.get -> int?
+Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma.EndCharacterIndex.get -> int?
+Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma.CharacterOffset.get -> int?
+~Microsoft.AspNetCore.Razor.Language.SourceSpan.SourceSpan(string filePath, int absoluteIndex, int lineIndex, int characterIndex, int length, int lineCount, int endCharacterIndex) -> void
+Microsoft.AspNetCore.Razor.Language.SourceSpan.LineCount.get -> int
+Microsoft.AspNetCore.Razor.Language.SourceSpan.EndCharacterIndex.get -> int
+virtual Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptionsBuilder.UseEnhancedLinePragma.get -> bool
+virtual Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptionsBuilder.UseEnhancedLinePragma.set -> void
+virtual Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions.UseEnhancedLinePragma.get -> bool
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptions.cs
index 0bd804a21d53..cc557826d928 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptions.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptions.cs
@@ -18,7 +18,8 @@ public static RazorCodeGenerationOptions CreateDefault()
suppressMetadataAttributes: false,
suppressPrimaryMethodBody: false,
suppressNullabilityEnforcement: false,
- omitMinimizedComponentAttributeValues: false);
+ omitMinimizedComponentAttributeValues: false,
+ useEnhancedLinePragma: true);
}
public static RazorCodeGenerationOptions CreateDesignTimeDefault()
@@ -32,7 +33,8 @@ public static RazorCodeGenerationOptions CreateDesignTimeDefault()
suppressMetadataAttributes: true,
suppressPrimaryMethodBody: false,
suppressNullabilityEnforcement: false,
- omitMinimizedComponentAttributeValues: false);
+ omitMinimizedComponentAttributeValues: false,
+ useEnhancedLinePragma: true);
}
public static RazorCodeGenerationOptions Create(Action configure)
@@ -130,5 +132,7 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action
public virtual bool OmitMinimizedComponentAttributeValues { get; }
+
+ public virtual bool UseEnhancedLinePragma { get; }
}
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptionsBuilder.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptionsBuilder.cs
index d8896d3050d5..d5015ff5d444 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptionsBuilder.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorCodeGenerationOptionsBuilder.cs
@@ -73,6 +73,8 @@ public abstract class RazorCodeGenerationOptionsBuilder
///
public virtual bool OmitMinimizedComponentAttributeValues { get; set; }
+ public virtual bool UseEnhancedLinePragma { get; set; }
+
public abstract RazorCodeGenerationOptions Build();
public virtual void SetDesignTime(bool designTime)
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/SourceSpan.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/SourceSpan.cs
index e4fdb45c90f2..2a04cf319c4b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/SourceSpan.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/SourceSpan.cs
@@ -17,17 +17,24 @@ public SourceSpan(int absoluteIndex, int length)
}
public SourceSpan(SourceLocation location, int contentLength)
- : this(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, contentLength)
+ : this(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, contentLength, lineCount: 1, endCharacterIndex: 0)
{
}
public SourceSpan(string filePath, int absoluteIndex, int lineIndex, int characterIndex, int length)
+ : this(filePath: filePath, absoluteIndex: absoluteIndex, lineIndex: lineIndex, characterIndex: characterIndex, length: length, lineCount: 0, endCharacterIndex: 0)
+ {
+ }
+
+ public SourceSpan(string filePath, int absoluteIndex, int lineIndex, int characterIndex, int length, int lineCount, int endCharacterIndex)
{
AbsoluteIndex = absoluteIndex;
LineIndex = lineIndex;
CharacterIndex = characterIndex;
Length = length;
FilePath = filePath;
+ LineCount = lineCount;
+ EndCharacterIndex = endCharacterIndex;
}
public SourceSpan(int absoluteIndex, int lineIndex, int characterIndex, int length)
@@ -43,6 +50,10 @@ public SourceSpan(int absoluteIndex, int lineIndex, int characterIndex, int leng
public int CharacterIndex { get; }
+ public int LineCount { get; }
+
+ public int EndCharacterIndex { get; }
+
public string FilePath { get; }
public bool Equals(SourceSpan other)
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxNodeExtensions.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxNodeExtensions.cs
index 562f233a8d3f..70c765a0f614 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxNodeExtensions.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Syntax/SyntaxNodeExtensions.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Text;
+using System.Text;
using Microsoft.AspNetCore.Razor.Language.Legacy;
namespace Microsoft.AspNetCore.Razor.Language.Syntax
@@ -18,18 +18,18 @@ public static TNode WithAnnotations(this TNode node, params SyntaxAnnotat
public static object GetAnnotationValue(this TNode node, string key) where TNode : SyntaxNode
{
- if (!node.ContainsAnnotations)
- {
- return null;
+ if (!node.ContainsAnnotations)
+ {
+ return null;
}
var annotations = node.GetAnnotations();
- foreach (var annotation in annotations)
- {
- if (annotation.Kind == key)
- {
- return annotation.Data;
- }
+ foreach (var annotation in annotations)
+ {
+ if (annotation.Kind == key)
+ {
+ return annotation.Data;
+ }
}
return null;
@@ -103,7 +103,9 @@ public static SourceLocation GetSourceLocation(this SyntaxNode node, RazorSource
public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source)
{
var location = node.GetSourceLocation(source);
- return new SourceSpan(location, node.FullWidth);
+ var endLocation = source.Lines.GetLocation(node.EndPosition);
+ var lineCount = endLocation.LineIndex - location.LineIndex;
+ return new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, node.FullWidth, lineCount, endLocation.CharacterIndex);
}
///
@@ -202,15 +204,15 @@ public static TRoot InsertNodesAfter(this TRoot root, SyntaxNode nodeInLi
public static string GetContent(this TNode node) where TNode : SyntaxNode
{
var builder = new StringBuilder();
- foreach (var token in node.DescendantNodesAndSelf())
- {
- if (!token.IsToken)
- {
- continue;
- }
-
- var syntaxToken = (SyntaxToken)token;
- builder.Append(syntaxToken.Content);
+ foreach (var token in node.DescendantNodesAndSelf())
+ {
+ if (!token.IsToken)
+ {
+ continue;
+ }
+
+ var syntaxToken = (SyntaxToken)token;
+ builder.Append(syntaxToken.Content);
}
return builder.ToString();
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs
index 7fcef3d42f69..ed3f4934a33e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs
@@ -6792,5 +6792,96 @@ public void ElementWithUppercaseTagName_CanHideWarningWithBang()
}
#endregion
+
+ #region LinePragmas
+
+ [Fact]
+ public void ProducesEnhancedLinePragmaWhenNecessary()
+ {
+ var generated = CompileToCSharp(@"
+Single line statement
+
+Time: @DateTime.Now
+
+Multiline block statement
+
+@JsonToHtml(@""{
+ 'key1': 'value1'
+ 'key2': 'value2'
+}"")
+
+@code {
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+}
+");
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated);
+ }
+
+ [Fact]
+ public void ProducesStandardLinePragmaForCSharpCode()
+ {
+ var generated = CompileToCSharp(@"
+Conditional statement
+@for (var i = 0; i < 10; i++)
+{
+ @i
+}
+
+Statements inside code block
+@{System.Console.WriteLine(1);System.Console.WriteLine(2);}
+
+Full-on code block
+@code {
+ [Parameter]
+ public int IncrementAmount { get; set; }
+}
+", throwOnFailure: false);
+
+ // Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated, throwOnFailure: false);
+ }
+
+ [Fact]
+ public void CanProduceLinePragmasForComponentWithRenderFragment()
+ {
+ var generated = CompileToCSharp(@"
+
+
@ActionText
+ @if (!Collapsed)
+ {
+
+ @ChildContent
+
+ }
+
+@code
+{
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) => @context
+ [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? ""Expand"" : ""Collapse""; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+}", throwOnFailure: false);
+
+// Assert
+ AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
+ AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
+ CompileToAssembly(generated, throwOnFailure: false);
+ }
+
+ #endregion
}
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs
new file mode 100644
index 000000000000..97bc88f2a93a
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs
@@ -0,0 +1,88 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #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
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+#nullable restore
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = ActionText;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ if (!Collapsed)
+ {
+
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 6 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = ChildContent;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ }
+
+#line default
+#line hidden
+#nullable disable
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 11 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) =>
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 13 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = context;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 13 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt
new file mode 100644
index 000000000000..d8ae413cd898
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt
@@ -0,0 +1,65 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ DesignTimeDirective -
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupElement - (0:0,0 [191] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlAttribute - (4:0,4 [12] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - row
+ HtmlContent - (17:0,17 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (17:0,17 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ MarkupElement - (21:1,2 [58] x:\dir\subdir\Test\TestComponent.cshtml) - a
+ HtmlAttribute - (23:1,4 [9] x:\dir\subdir\Test\TestComponent.cshtml) - href=" - "
+ HtmlAttributeValue - (30:1,11 [1] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (30:1,11 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
+ HtmlAttribute - (32:1,13 [16] x:\dir\subdir\Test\TestComponent.cshtml) - @onclick= -
+ HtmlAttributeValue - (42:1,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (42:1,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Toggle
+ HtmlAttribute - (48:1,29 [15] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (56:1,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (56:1,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - col-12
+ CSharpExpression - (65:1,46 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (65:1,46 [10] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ActionText
+ HtmlContent - (79:1,60 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (79:1,60 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (84:2,3 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (84:2,3 [26] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - if (!Collapsed)\n {\n
+ MarkupElement - (110:4,4 [68] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlAttribute - (114:4,8 [30] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (122:4,16 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (122:4,16 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - col-12
+ HtmlAttributeValue - (128:4,22 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (129:4,23 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - card
+ HtmlAttributeValue - (133:4,27 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (134:4,28 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - card-body
+ HtmlContent - (145:4,39 [8] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (145:4,39 [8] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpExpression - (154:5,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (154:5,7 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ChildContent
+ HtmlContent - (166:5,19 [6] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (166:5,19 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (178:6,10 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (178:6,10 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n }
+ HtmlContent - (183:7,3 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (183:7,3 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlContent - (191:8,6 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (191:8,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter]\n public RenderFragment ChildContent { get; set; } = (context) =>
+ MarkupElement - (284:12,66 [15] x:\dir\subdir\Test\TestComponent.cshtml) - p
+ CSharpExpression - (288:12,70 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (288:12,70 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context
+ CSharpCode - (299:12,81 [179] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (299:12,81 [179] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter]\n public bool Collapsed { get; set; }\n string ActionText { get => Collapsed ? "Expand" : "Collapse"; }\n void Toggle()\n {\n Collapsed = !Collapsed;\n }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt
new file mode 100644
index 000000000000..2de736af3ff9
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt
@@ -0,0 +1,61 @@
+Source Location: (65:1,46 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+|ActionText|
+Generated Location: (898:24,46 [10] )
+|ActionText|
+
+Source Location: (84:2,3 [26] x:\dir\subdir\Test\TestComponent.cshtml)
+|if (!Collapsed)
+ {
+ |
+Generated Location: (1034:31,3 [26] )
+|if (!Collapsed)
+ {
+ |
+
+Source Location: (154:5,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+|ChildContent|
+Generated Location: (1189:40,7 [12] )
+|ChildContent|
+
+Source Location: (178:6,10 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ }|
+Generated Location: (1334:47,10 [5] )
+|
+ }|
+
+Source Location: (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) => |
+Generated Location: (1512:57,1 [83] )
+|
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) => |
+
+Source Location: (288:12,70 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+|context|
+Generated Location: (1788:66,70 [7] )
+|context|
+
+Source Location: (299:12,81 [179] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+|
+Generated Location: (2000:73,81 [179] )
+|
+ [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs
new file mode 100644
index 000000000000..054ae6647e71
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs
@@ -0,0 +1,55 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #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
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+#nullable restore
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = DateTime.Now;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
+__o = JsonToHtml(@"{
+ 'key1': 'value1'
+ 'key2': 'value2'
+}");
+
+#line default
+#line hidden
+#nullable disable
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 12 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt
new file mode 100644
index 000000000000..77efe019204b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt
@@ -0,0 +1,38 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ DesignTimeDirective -
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupElement - (0:0,0 [30] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (4:0,4 [21] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (4:0,4 [21] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Single line statement
+ HtmlContent - (30:0,30 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (30:0,30 [10] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\nTime:
+ CSharpExpression - (41:2,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (41:2,7 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - DateTime.Now
+ HtmlContent - (53:2,19 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (53:2,19 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ MarkupElement - (57:4,0 [34] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (61:4,4 [25] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (61:4,4 [25] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Multiline block statement
+ HtmlContent - (91:4,34 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (91:4,34 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ CSharpExpression - (96:6,1 [59] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (96:6,1 [59] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - JsonToHtml(@"{\n 'key1': 'value1'\n 'key2': 'value2'\n}")
+ HtmlContent - (155:9,3 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (155:9,3 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ HtmlContent - (246:16,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (246:16,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string JsonToHtml(string foo)\n {\n return foo;\n }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt
new file mode 100644
index 000000000000..4de2c518aab8
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt
@@ -0,0 +1,31 @@
+Source Location: (41:2,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+|DateTime.Now|
+Generated Location: (859:24,7 [12] )
+|DateTime.Now|
+
+Source Location: (96:6,1 [59] x:\dir\subdir\Test\TestComponent.cshtml)
+|JsonToHtml(@"{
+ 'key1': 'value1'
+ 'key2': 'value2'
+}")|
+Generated Location: (1000:31,6 [59] )
+|JsonToHtml(@"{
+ 'key1': 'value1'
+ 'key2': 'value2'
+}")|
+
+Source Location: (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+|
+Generated Location: (1239:43,7 [79] )
+|
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs
new file mode 100644
index 000000000000..ea5ced8d8de4
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs
@@ -0,0 +1,67 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #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
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+#nullable restore
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ for (var i = 0; i < 10; i++)
+{
+
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
+ __o = i;
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+}
+
+#line default
+#line hidden
+#nullable disable
+#nullable restore
+#line 8 "x:\dir\subdir\Test\TestComponent.cshtml"
+ System.Console.WriteLine(1);System.Console.WriteLine(2);
+
+#line default
+#line hidden
+#nullable disable
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 11 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ [Parameter]
+ public int IncrementAmount { get; set; }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt
new file mode 100644
index 000000000000..ae939cab3d53
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt
@@ -0,0 +1,48 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [12] ) - System
+ UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [17] ) - System.Linq
+ UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ DesignTimeDirective -
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning disable 0414
+ CSharpCode -
+ IntermediateToken - - CSharp - private static System.Object __o = null;
+ CSharpCode -
+ IntermediateToken - - CSharp - #pragma warning restore 0414
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupElement - (0:0,0 [30] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (4:0,4 [21] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (4:0,4 [21] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Conditional statement
+ HtmlContent - (30:0,30 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (30:0,30 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (33:1,1 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (33:1,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - for (var i = 0; i < 10; i++)\n{\n
+ MarkupElement - (70:3,4 [9] x:\dir\subdir\Test\TestComponent.cshtml) - p
+ CSharpExpression - (74:3,8 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (74:3,8 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - i
+ CSharpCode - (79:3,13 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (79:3,13 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n}
+ HtmlContent - (82:4,1 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (82:4,1 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ MarkupElement - (86:6,0 [37] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (90:6,4 [28] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (90:6,4 [28] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Statements inside code block
+ HtmlContent - (123:6,37 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (123:6,37 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - System.Console.WriteLine(1);System.Console.WriteLine(2);
+ HtmlContent - (186:8,0 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (186:8,0 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ MarkupElement - (188:9,0 [27] x:\dir\subdir\Test\TestComponent.cshtml) - h1
+ HtmlContent - (192:9,4 [18] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (192:9,4 [18] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Full-on code block
+ HtmlContent - (215:9,27 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (215:9,27 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ HtmlContent - (290:13,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (290:13,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
+ CSharpCode - (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter]\n public int IncrementAmount { get; set; }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt
new file mode 100644
index 000000000000..a45036fb6987
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt
@@ -0,0 +1,37 @@
+Source Location: (33:1,1 [37] x:\dir\subdir\Test\TestComponent.cshtml)
+|for (var i = 0; i < 10; i++)
+{
+ |
+Generated Location: (853:24,1 [37] )
+|for (var i = 0; i < 10; i++)
+{
+ |
+
+Source Location: (74:3,8 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+|i|
+Generated Location: (1020:33,8 [1] )
+|i|
+
+Source Location: (79:3,13 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+}|
+Generated Location: (1157:40,13 [3] )
+|
+}|
+
+Source Location: (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml)
+|System.Console.WriteLine(1);System.Console.WriteLine(2);|
+Generated Location: (1284:48,2 [56] )
+|System.Console.WriteLine(1);System.Console.WriteLine(2);|
+
+Source Location: (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ [Parameter]
+ public int IncrementAmount { get; set; }
+|
+Generated Location: (1519:57,7 [65] )
+|
+ [Parameter]
+ public int IncrementAmount { get; set; }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
index 56e503acc824..a2aff6a823d0 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs
@@ -22,15 +22,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
(__builder2) => {
__builder2.OpenElement(0, "div");
- __builder2.AddContent(1,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLowerInvariant()
+#line (1,56)-(1,82) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(1, context.ToLowerInvariant());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
index 39e731d94314..97573282a53b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt
@@ -5,6 +5,6 @@ Generated Location: (586:17,2 [46] )
Source Location: (87:0,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1248:37,87 [2] )
+Generated Location: (1172:35,87 [2] )
|; |
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
index aea807c13685..d52172d1bed2 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs
@@ -22,15 +22,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
(__builder2) => {
__builder2.OpenElement(0, "div");
- __builder2.AddContent(1,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLowerInvariant()
+#line (1,56)-(1,82) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(1, context.ToLowerInvariant());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
index 39e731d94314..97573282a53b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt
@@ -5,6 +5,6 @@ Generated Location: (586:17,2 [46] )
Source Location: (87:0,87 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1248:37,87 [2] )
+Generated Location: (1172:35,87 [2] )
|; |
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs
new file mode 100644
index 000000000000..1b91a6f487b0
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.codegen.cs
@@ -0,0 +1,91 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.OpenElement(0, "div");
+ __builder.AddAttribute(1, "class", "row");
+ __builder.OpenElement(2, "a");
+ __builder.AddAttribute(3, "href", "#");
+ __builder.AddAttribute(4, "@onclick", "Toggle");
+ __builder.AddAttribute(5, "class", "col-12");
+#nullable restore
+#line (2,47)-(2,57) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(6, ActionText);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+#nullable restore
+#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
+ if (!Collapsed)
+ {
+
+#line default
+#line hidden
+#nullable disable
+ __builder.OpenElement(7, "div");
+ __builder.AddAttribute(8, "class", "col-12 card card-body");
+#nullable restore
+#line (6,8)-(6,20) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(9, ChildContent);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+#nullable restore
+#line 8 "x:\dir\subdir\Test\TestComponent.cshtml"
+ }
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 11 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) =>
+
+#line default
+#line hidden
+#nullable disable
+ __builder.OpenElement(10, "p");
+#nullable restore
+#line (13,71)-(13,78) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(11, context);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+#nullable restore
+#line 14 "x:\dir\subdir\Test\TestComponent.cshtml"
+ [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt
new file mode 100644
index 000000000000..e8d1879dc291
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.ir.txt
@@ -0,0 +1,48 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupElement - (0:0,0 [191] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlAttribute - (4:0,4 [12] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (12:0,12 [3] x:\dir\subdir\Test\TestComponent.cshtml) - Html - row
+ MarkupElement - (21:1,2 [58] x:\dir\subdir\Test\TestComponent.cshtml) - a
+ HtmlAttribute - (23:1,4 [9] x:\dir\subdir\Test\TestComponent.cshtml) - href=" - "
+ HtmlAttributeValue - (30:1,11 [1] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (30:1,11 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - #
+ HtmlAttribute - (32:1,13 [16] x:\dir\subdir\Test\TestComponent.cshtml) - @onclick= -
+ HtmlAttributeValue - (42:1,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (42:1,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Toggle
+ HtmlAttribute - (48:1,29 [15] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (56:1,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (56:1,37 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - col-12
+ CSharpExpression - (65:1,46 [10] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (65:1,46 [10] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ActionText
+ CSharpCode - (81:2,0 [2] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (81:2,0 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp -
+ CSharpCode - (84:2,3 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (84:2,3 [22] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - if (!Collapsed)\n {\n
+ MarkupElement - (110:4,4 [68] x:\dir\subdir\Test\TestComponent.cshtml) - div
+ HtmlAttribute - (114:4,8 [30] x:\dir\subdir\Test\TestComponent.cshtml) - class=" - "
+ HtmlAttributeValue - (122:4,16 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (122:4,16 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - col-12
+ HtmlAttributeValue - (128:4,22 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (129:4,23 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - card
+ HtmlAttributeValue - (133:4,27 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
+ LazyIntermediateToken - (134:4,28 [9] x:\dir\subdir\Test\TestComponent.cshtml) - Html - card-body
+ CSharpExpression - (154:5,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (154:5,7 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ChildContent
+ CSharpCode - (180:7,0 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (180:7,0 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - }\n
+ CSharpCode - (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter]\n public RenderFragment ChildContent { get; set; } = (context) =>
+ MarkupElement - (284:12,66 [15] x:\dir\subdir\Test\TestComponent.cshtml) - p
+ CSharpExpression - (288:12,70 [7] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (288:12,70 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - context
+ CSharpCode - (301:13,0 [177] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (301:13,0 [177] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - [Parameter]\n public bool Collapsed { get; set; }\n string ActionText { get => Collapsed ? "Expand" : "Collapse"; }\n void Toggle()\n {\n Collapsed = !Collapsed;\n }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt
new file mode 100644
index 000000000000..c326afb4e2ad
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CanProduceLinePragmasForComponentWithRenderFragment/TestComponent.mappings.txt
@@ -0,0 +1,44 @@
+Source Location: (84:2,3 [22] x:\dir\subdir\Test\TestComponent.cshtml)
+|if (!Collapsed)
+ {
+|
+Generated Location: (1119:31,3 [22] )
+|if (!Collapsed)
+ {
+|
+
+Source Location: (180:7,0 [5] x:\dir\subdir\Test\TestComponent.cshtml)
+| }
+|
+Generated Location: (1594:49,0 [5] )
+| }
+|
+
+Source Location: (201:10,1 [83] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) => |
+Generated Location: (1809:59,1 [83] )
+|
+ [Parameter]
+ public RenderFragment ChildContent { get; set; } = (context) => |
+
+Source Location: (301:13,0 [177] x:\dir\subdir\Test\TestComponent.cshtml)
+| [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+|
+Generated Location: (2264:77,0 [177] )
+| [Parameter]
+ public bool Collapsed { get; set; }
+ string ActionText { get => Collapsed ? "Expand" : "Collapse"; }
+ void Toggle()
+ {
+ Collapsed = !Collapsed;
+ }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CascadingGenericInference_GenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CascadingGenericInference_GenericChildContent/TestComponent.codegen.cs
index be0ec485f239..4ca8fd57c579 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CascadingGenericInference_GenericChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/CascadingGenericInference_GenericChildContent/TestComponent.codegen.cs
@@ -25,15 +25,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
, out var __typeInferenceArg_0___arg0);
__Blazor.Test.TestComponent.TypeInference.CreateGrid_0(__builder, 0, 1, __typeInferenceArg_0___arg0, 2, (__builder2) => {
__Blazor.Test.TestComponent.TypeInference.CreateColumn_1(__builder2, 3, __typeInferenceArg_0___arg0, 4, (context) => (__builder3) => {
- __builder3.AddContent(5,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.Year
+#line (1,51)-(1,63) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder3.AddContent(5, context.Year);
#line default
#line hidden
#nullable disable
- );
}
);
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs
index 00cbb3cdbc9e..a9530190bf2c 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent/TestComponent.codegen.cs
@@ -25,15 +25,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
));
__builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => {
__builder2.OpenElement(3, "div");
- __builder2.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,9)-(2,26) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, context.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs
index 46d5636adb62..63f9486dae31 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericChildContent_TypeInference/TestComponent.codegen.cs
@@ -23,15 +23,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
, 2, (context) => (__builder2) => {
__builder2.OpenElement(3, "div");
- __builder2.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,9)-(2,26) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, context.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
);
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs
index 2bc9097bc2e4..b25f4dd1e06b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics/TestComponent.codegen.cs
@@ -25,28 +25,24 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
));
__builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => {
__builder2.OpenElement(3, "div");
- __builder2.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,23)-(2,40) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, context.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
__builder.AddAttribute(5, "AnotherChildContent", (Microsoft.AspNetCore.Components.RenderFragment.Context>)((item) => (__builder2) => {
- __builder2.AddContent(6,
#nullable restore
-#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
- System.Math.Max(0, item.Item)
+#line (4,4)-(4,33) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(6, System.Math.Max(0, item.Item));
#line default
#line hidden
#nullable disable
- );
__builder2.AddMarkupContent(7, ";\r\n");
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs
index 0e4bdda7a207..bc61c88a6e66 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_MultipleGenerics_TypeInference/TestComponent.codegen.cs
@@ -31,27 +31,23 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
, 3, (context) => (__builder2) => {
__builder2.OpenElement(4, "div");
- __builder2.AddContent(5,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,23)-(2,40) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(5, context.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
, 6, (item) => (__builder2) => {
- __builder2.AddContent(7,
#nullable restore
-#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
- System.Math.Max(0, item.Item)
+#line (4,4)-(4,33) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(7, System.Math.Max(0, item.Item));
#line default
#line hidden
#nullable disable
- );
__builder2.AddMarkupContent(8, ";\r\n");
}
);
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_NonGenericParameterizedChildContent_TypeInference/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_NonGenericParameterizedChildContent_TypeInference/TestComponent.codegen.cs
index 24a8d5ea4281..c1f5d8f36f85 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_NonGenericParameterizedChildContent_TypeInference/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_NonGenericParameterizedChildContent_TypeInference/TestComponent.codegen.cs
@@ -22,26 +22,22 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#line hidden
#nullable disable
, 2, (context) => (__builder2) => {
- __builder2.AddContent(3,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,21)-(2,38) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(3, context.ToLower());
#line default
#line hidden
#nullable disable
- );
}
, 4, (context) => (__builder2) => {
- __builder2.AddContent(5,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- context
+#line (3,17)-(3,24) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(5, context);
#line default
#line hidden
#nullable disable
- );
}
);
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
index b0cf616b9331..20c79387766f 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs
@@ -15,15 +15,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
{
__builder.OpenComponent(0);
__builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => {
- __builder2.AddContent(2,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context
+#line (1,29)-(1,36) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(2, context);
#line default
#line hidden
#nullable disable
- );
}
));
__builder.CloseComponent();
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
index 088e82ba83eb..7b01ad01b1e1 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs
@@ -19,15 +19,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder2.AddContent(3, "Some text");
__builder2.OpenElement(4, "some-child");
__builder2.AddAttribute(5, "a", "1");
- __builder2.AddContent(6,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLowerInvariant()
+#line (1,55)-(1,81) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(6, context.ToLowerInvariant());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
index 572862ad7113..2bd539ee5012 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs
@@ -19,15 +19,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder2.AddMarkupContent(3, "\r\n Some text");
__builder2.OpenElement(4, "some-child");
__builder2.AddAttribute(5, "a", "1");
- __builder2.AddContent(6,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- item.ToLowerInvariant()
+#line (3,33)-(3,56) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(6, item.ToLowerInvariant());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs
index 572862ad7113..2bd539ee5012 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs
@@ -19,15 +19,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder2.AddMarkupContent(3, "\r\n Some text");
__builder2.OpenElement(4, "some-child");
__builder2.AddAttribute(5, "a", "1");
- __builder2.AddContent(6,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- item.ToLowerInvariant()
+#line (3,33)-(3,56) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(6, item.ToLowerInvariant());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs
index fd2c964e59d2..aa5794d6945a 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs
@@ -29,15 +29,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder.AddMarkupContent(3, "\r\n");
__builder.OpenComponent(4);
__builder.AddAttribute(5, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => {
- __builder2.AddContent(6,
#nullable restore
-#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
- context
+#line (7,14)-(7,21) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(6, context);
#line default
#line hidden
#nullable disable
- );
}
));
__builder.CloseComponent();
@@ -51,15 +49,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder.AddMarkupContent(11, "\r\n");
__builder.OpenComponent(12);
__builder.AddAttribute(13, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => {
- __builder2.AddContent(14,
#nullable restore
-#line 13 "x:\dir\subdir\Test\TestComponent.cshtml"
- context
+#line (13,14)-(13,21) 26 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(14, context);
#line default
#line hidden
#nullable disable
- );
}
));
__builder.CloseComponent();
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs
index e65f403066b3..0abb8cb37094 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentImports/_Imports.codegen.cs
@@ -28,15 +28,13 @@ public partial class _Imports : System.Object
#pragma warning disable 1998
protected void Execute()
{
- __builder.AddContent(0,
#nullable restore
-#line 5 "x:\dir\subdir\Test\_Imports.razor"
- Foo
+#line (5,2)-(5,5) 24 "x:\dir\subdir\Test\_Imports.razor"
+__builder.AddContent(0, Foo);
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.codegen.cs
index ad841383def5..7cbbfcb8ecc6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.codegen.cs
@@ -31,15 +31,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#line hidden
#nullable disable
__builder.OpenElement(1, "p");
- __builder.AddContent(2,
#nullable restore
-#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
- ChildContent(item2)
+#line (9,6)-(9,25) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, ChildContent(item2));
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(3, ";\r\n ");
__builder.CloseElement();
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.mappings.txt
index 243bbbe5303e..43737fd56ff2 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithConstrainedTypeParameters/TestComponent.mappings.txt
@@ -10,7 +10,7 @@ Generated Location: (832:26,1 [34] )
Source Location: (221:10,0 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|}
|
-Generated Location: (1327:48,0 [3] )
+Generated Location: (1308:46,0 [3] )
|}
|
@@ -20,7 +20,7 @@ Source Location: (231:11,7 [185] x:\dir\subdir\Test\TestComponent.cshtml)
[Parameter] public List Items2 { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
|
-Generated Location: (1507:57,7 [185] )
+Generated Location: (1488:55,7 [185] )
|
[Parameter] public TItem1 Item1 { get; set; }
[Parameter] public List Items2 { get; set; }
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs
index 01fd4ddfbacf..878e8653421b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.codegen.cs
@@ -29,15 +29,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#line hidden
#nullable disable
__builder.OpenElement(1, "p");
- __builder.AddContent(2,
#nullable restore
-#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
- ChildContent(item2)
+#line (9,6)-(9,25) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, ChildContent(item2));
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(3, ";\r\n ");
__builder.CloseElement();
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt
index f039f8827d03..4f0a00fbb0ac 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTypeParameters/TestComponent.mappings.txt
@@ -10,7 +10,7 @@ Generated Location: (779:24,1 [34] )
Source Location: (178:10,0 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|}
|
-Generated Location: (1274:46,0 [3] )
+Generated Location: (1255:44,0 [3] )
|}
|
@@ -20,7 +20,7 @@ Source Location: (188:11,7 [185] x:\dir\subdir\Test\TestComponent.cshtml)
[Parameter] public List Items2 { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
|
-Generated Location: (1454:55,7 [185] )
+Generated Location: (1435:53,7 [185] )
|
[Parameter] public TItem1 Item1 { get; set; }
[Parameter] public List Items2 { get; set; }
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_InImports/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_InImports/TestComponent.codegen.cs
index 55984e6f7922..b59a602fc43a 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_InImports/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_InImports/TestComponent.codegen.cs
@@ -17,15 +17,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder.AddMarkupContent(1, "\r\n ");
__builder.OpenElement(2, "child");
__builder.AddContent(3, " ");
- __builder.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- DateTime.Now
+#line (2,14)-(2,26) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(4, DateTime.Now);
#line default
#line hidden
#nullable disable
- );
__builder.AddContent(5, " ");
__builder.CloseElement();
__builder.AddMarkupContent(6, "\r\n");
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_OverrideImports/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_OverrideImports/TestComponent.codegen.cs
index d126cfe16301..639a1f71a236 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_OverrideImports/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_PreserveWhitespaceDirective_OverrideImports/TestComponent.codegen.cs
@@ -15,15 +15,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
{
__builder.OpenElement(0, "parent");
__builder.OpenElement(1, "child");
- __builder.AddContent(2,
#nullable restore
-#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
- DateTime.Now
+#line (4,14)-(4,26) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, DateTime.Now);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
__builder.CloseElement();
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.codegen.cs
index 6e2c5dbff44f..cf807511ef77 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.codegen.cs
@@ -135,15 +135,13 @@ void MethodRenderingMarkup(RenderTreeBuilder __builder)
);
__builder.AddAttribute(25, "TestCssScope");
__builder.AddContent(26, "Something ");
- __builder.AddContent(27,
#nullable restore
-#line 26 "x:\dir\subdir\Test\TestComponent.cshtml"
- i
+#line (26,42)-(26,43) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(27, i);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
#nullable restore
#line 27 "x:\dir\subdir\Test\TestComponent.cshtml"
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.mappings.txt
index 1dd0bdefa258..cd5ccecd2eaa 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.mappings.txt
@@ -55,7 +55,7 @@ Source Location: (933:26,0 [164] x:\dir\subdir\Test\TestComponent.cshtml)
System.GC.KeepAlive(myVariable);
}
|
-Generated Location: (5112:159,0 [164] )
+Generated Location: (5067:157,0 [164] )
| }
System.GC.KeepAlive(myElementReference);
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.codegen.cs
index 9a181f7d6085..298487ab6655 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.codegen.cs
@@ -23,15 +23,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#line hidden
#nullable disable
__builder.OpenElement(1, "li");
- __builder.AddContent(2,
#nullable restore
-#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
- item
+#line (7,14)-(7,18) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, item);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
#nullable restore
#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.mappings.txt
index e9f9b3f79cf2..02ec007db68f 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_False/TestComponent.mappings.txt
@@ -10,7 +10,7 @@ Generated Location: (634:18,5 [55] )
Source Location: (143:8,0 [7] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1086:37,0 [7] )
+Generated Location: (1060:35,0 [7] )
| }
|
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.codegen.cs
index 6bbdab042858..0f0ba98dc929 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.codegen.cs
@@ -27,15 +27,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder.AddContent(3, " ");
__builder.OpenElement(4, "li");
__builder.AddMarkupContent(5, "\r\n ");
- __builder.AddContent(6,
#nullable restore
-#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
- item
+#line (7,14)-(7,18) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(6, item);
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(7, "\r\n ");
__builder.CloseElement();
__builder.AddMarkupContent(8, "\r\n");
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.mappings.txt
index d3e86e7e52ca..fc64f11f6bce 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithPreserveWhitespaceDirective_True/TestComponent.mappings.txt
@@ -10,7 +10,7 @@ Generated Location: (738:20,5 [55] )
Source Location: (142:8,0 [7] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1416:43,0 [7] )
+Generated Location: (1390:41,0 [7] )
| }
|
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs
index dcab0dfd430a..524c19d6fa4d 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithFullyQualifiedTagName/TestComponent.codegen.cs
@@ -23,15 +23,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
, 2, (context) => (__builder2) => {
__builder2.OpenElement(3, "div");
- __builder2.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.ToLower()
+#line (2,9)-(2,26) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, context.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
);
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
index 121ad727abf5..f4c4dece3fa6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -13,15 +13,13 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
- __builder.AddContent(0,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- "My value"
+#line (1,3)-(1,13) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(0, "My value");
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(1, "\r\n\r\n");
__builder.AddMarkupContent(2, "Hello
");
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
index 254f08796496..3172478d398b 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
@@ -17,28 +17,24 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
__builder2.OpenElement(2, "h1");
__builder2.AddContent(3, "Child content at ");
- __builder2.AddContent(4,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- DateTime.Now
+#line (2,27)-(2,39) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, DateTime.Now);
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
__builder2.AddMarkupContent(5, "\r\n ");
__builder2.OpenElement(6, "p");
__builder2.AddContent(7, "Very ");
- __builder2.AddContent(8,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- "good"
+#line (3,15)-(3,21) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(8, "good");
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
));
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
index 121ad727abf5..f4c4dece3fa6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -13,15 +13,13 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
- __builder.AddContent(0,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- "My value"
+#line (1,3)-(1,13) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(0, "My value");
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(1, "\r\n\r\n");
__builder.AddMarkupContent(2, "Hello
");
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
index b19d4dc73c2b..b6a763b13577 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_LeadingWhiteSpace_WithComponent/TestComponent.codegen.cs
@@ -18,28 +18,24 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
__builder2.AddMarkupContent(2, "\r\n ");
__builder2.OpenElement(3, "h1");
__builder2.AddContent(4, "Child content at ");
- __builder2.AddContent(5,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- DateTime.Now
+#line (2,27)-(2,39) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(5, DateTime.Now);
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
__builder2.AddMarkupContent(6, "\r\n ");
__builder2.OpenElement(7, "p");
__builder2.AddContent(8, "Very ");
- __builder2.AddContent(9,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- "good"
+#line (3,15)-(3,21) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(9, "good");
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
__builder2.AddMarkupContent(10, "\r\n");
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
index f5ef41e3b810..5071dbd8290e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -14,15 +14,13 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.AddMarkupContent(0, "Hello
\r\n\r\n");
- __builder.AddContent(1,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- "My value"
+#line (3,3)-(3,13) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(1, "My value");
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
index a6d59b4752b4..d94be464b131 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
@@ -45,15 +45,13 @@ void MyMethod(RenderTreeBuilder __builder)
__builder.AddContent(3, " ");
__builder.OpenElement(4, "li");
__builder.AddMarkupContent(5, "\r\n ");
- __builder.AddContent(6,
#nullable restore
-#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
- i
+#line (9,22)-(9,23) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(6, i);
#line default
#line hidden
#nullable disable
- );
__builder.AddMarkupContent(7, "\r\n ");
__builder.CloseElement();
__builder.AddMarkupContent(8, "\r\n");
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
index 2910248103c5..89c55ee6a9d5 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Legacy_3_1_WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
@@ -21,14 +21,14 @@ Generated Location: (1135:38,13 [46] )
Source Location: (256:10,0 [15] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1802:61,0 [15] )
+Generated Location: (1776:59,0 [15] )
| }
|
Source Location: (286:12,0 [7] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (2068:71,0 [7] )
+Generated Location: (2042:69,0 [7] )
| }
|
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs
index f74394ce807b..4bb13b6f7f6a 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MarkupComment_IsNotIncluded/TestComponent.codegen.cs
@@ -22,15 +22,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#line hidden
#nullable disable
__builder.OpenElement(0, "div");
- __builder.AddContent(1,
#nullable restore
-#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
- myValue
+#line (4,7)-(4,14) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(1, myValue);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
}
#pragma warning restore 1998
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
index 650a35e5af86..13c975829cdf 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/MultipleExplictChildContent/TestComponent.codegen.cs
@@ -19,15 +19,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
}
));
__builder.AddAttribute(3, "Footer", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
- __builder2.AddContent(4,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- "bye!"
+#line (3,15)-(3,21) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, "bye!");
#line default
#line hidden
#nullable disable
- );
}
));
__builder.CloseComponent();
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs
new file mode 100644
index 000000000000..72b886b9d176
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.codegen.cs
@@ -0,0 +1,51 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Single line statement
\r\n\r\nTime: ");
+#nullable restore
+#line (3,8)-(3,20) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(1, DateTime.Now);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.AddMarkupContent(2, "\r\n\r\n");
+ __builder.AddMarkupContent(3, "Multiline block statement
\r\n\r\n");
+#nullable restore
+#line (7,2)-(10,4) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(4, JsonToHtml(@"{
+ 'key1': 'value1'
+ 'key2': 'value2'
+}"));
+
+#line default
+#line hidden
+#nullable disable
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 12 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt
new file mode 100644
index 000000000000..55684510e3c1
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.ir.txt
@@ -0,0 +1,19 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupBlock - - Single line statement
\n\nTime:
+ CSharpExpression - (41:2,7 [12] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (41:2,7 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - DateTime.Now
+ HtmlContent - (53:2,19 [4] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (53:2,19 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
+ MarkupBlock - - Multiline block statement
\n\n
+ CSharpExpression - (96:6,1 [59] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (96:6,1 [59] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - JsonToHtml(@"{\n 'key1': 'value1'\n 'key2': 'value2'\n}")
+ CSharpCode - (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string JsonToHtml(string foo)\n {\n return foo;\n }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt
new file mode 100644
index 000000000000..8f60b4a0f049
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesEnhancedLinePragmaWhenNecessary/TestComponent.mappings.txt
@@ -0,0 +1,15 @@
+Source Location: (166:11,7 [79] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+|
+Generated Location: (1274:47,7 [79] )
+|
+ public string JsonToHtml(string foo)
+ {
+ return foo;
+ }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs
new file mode 100644
index 000000000000..3675e1d249b8
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.codegen.cs
@@ -0,0 +1,63 @@
+//
+#pragma warning disable 1591
+namespace Test
+{
+ #line hidden
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Components;
+ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
+ {
+ #pragma warning disable 1998
+ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
+ {
+ __builder.AddMarkupContent(0, "Conditional statement
");
+#nullable restore
+#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
+ for (var i = 0; i < 10; i++)
+{
+
+#line default
+#line hidden
+#nullable disable
+ __builder.OpenElement(1, "p");
+#nullable restore
+#line (4,9)-(4,10) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, i);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.CloseElement();
+#nullable restore
+#line 5 "x:\dir\subdir\Test\TestComponent.cshtml"
+}
+
+#line default
+#line hidden
+#nullable disable
+ __builder.AddMarkupContent(3, "Statements inside code block
");
+#nullable restore
+#line 8 "x:\dir\subdir\Test\TestComponent.cshtml"
+ System.Console.WriteLine(1);System.Console.WriteLine(2);
+
+#line default
+#line hidden
+#nullable disable
+ __builder.AddMarkupContent(4, "Full-on code block
");
+ }
+ #pragma warning restore 1998
+#nullable restore
+#line 11 "x:\dir\subdir\Test\TestComponent.cshtml"
+
+ [Parameter]
+ public int IncrementAmount { get; set; }
+
+#line default
+#line hidden
+#nullable disable
+ }
+}
+#pragma warning restore 1591
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt
new file mode 100644
index 000000000000..53197050025c
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.ir.txt
@@ -0,0 +1,23 @@
+Document -
+ NamespaceDeclaration - - Test
+ UsingDirective - (3:1,1 [14] ) - System
+ UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
+ UsingDirective - (53:3,1 [19] ) - System.Linq
+ UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
+ UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
+ ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
+ MethodDeclaration - - protected override - void - BuildRenderTree
+ MarkupBlock - - Conditional statement
+ CSharpCode - (33:1,1 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (33:1,1 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - for (var i = 0; i < 10; i++)\n{\n
+ MarkupElement - (70:3,4 [9] x:\dir\subdir\Test\TestComponent.cshtml) - p
+ CSharpExpression - (74:3,8 [1] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (74:3,8 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - i
+ CSharpCode - (81:4,0 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (81:4,0 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - }\n
+ MarkupBlock - - Statements inside code block
+ CSharpCode - (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - System.Console.WriteLine(1);System.Console.WriteLine(2);
+ MarkupBlock - - Full-on code block
+ CSharpCode - (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
+ LazyIntermediateToken - (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n [Parameter]\n public int IncrementAmount { get; set; }\n
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt
new file mode 100644
index 000000000000..20e682e9372b
--- /dev/null
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ProducesStandardLinePragmaForCSharpCode/TestComponent.mappings.txt
@@ -0,0 +1,32 @@
+Source Location: (33:1,1 [33] x:\dir\subdir\Test\TestComponent.cshtml)
+|for (var i = 0; i < 10; i++)
+{
+|
+Generated Location: (663:18,1 [33] )
+|for (var i = 0; i < 10; i++)
+{
+|
+
+Source Location: (81:4,0 [3] x:\dir\subdir\Test\TestComponent.cshtml)
+|}
+|
+Generated Location: (1062:35,0 [3] )
+|}
+|
+
+Source Location: (127:7,2 [56] x:\dir\subdir\Test\TestComponent.cshtml)
+|System.Console.WriteLine(1);System.Console.WriteLine(2);|
+Generated Location: (1272:43,2 [56] )
+|System.Console.WriteLine(1);System.Console.WriteLine(2);|
+
+Source Location: (224:10,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
+|
+ [Parameter]
+ public int IncrementAmount { get; set; }
+|
+Generated Location: (1582:53,7 [65] )
+|
+ [Parameter]
+ public int IncrementAmount { get; set; }
+|
+
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
index 0613474b37c3..d10055a70e97 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs
@@ -23,25 +23,21 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
(__builder2) => {
__builder2.OpenElement(0, "li");
__builder2.AddContent(1, "#");
- __builder2.AddContent(2,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.Index
+#line (1,64)-(1,77) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(2, context.Index);
#line default
#line hidden
#nullable disable
- );
__builder2.AddContent(3, " - ");
- __builder2.AddContent(4,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- context.Item.ToLower()
+#line (1,81)-(1,103) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(4, context.Item.ToLower());
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
index 189474be149b..abb790de732e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt
@@ -5,6 +5,6 @@ Generated Location: (586:17,2 [54] )
Source Location: (107:0,107 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1655:48,107 [2] )
+Generated Location: (1471:44,107 [2] )
|; |
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
index 2f8f2fa5cf46..67e8e43007b6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.codegen.cs
@@ -45,15 +45,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
__builder.OpenComponent(3);
__builder.AddAttribute(4, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
- __builder2.AddContent(5,
#nullable restore
-#line 5 "x:\dir\subdir\Test\TestComponent.cshtml"
- "hello, world!"
+#line (5,3)-(5,18) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(5, "hello, world!");
#line default
#line hidden
#nullable disable
- );
}
));
__builder.CloseComponent();
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
index 24ba081f5bb6..fe3dec2f0d33 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_FollowedByComponent/TestComponent.mappings.txt
@@ -19,7 +19,7 @@ Source Location: (159:7,7 [76] x:\dir\subdir\Test\TestComponent.cshtml)
public string Name { get; set; }
}
|
-Generated Location: (2101:63,7 [76] )
+Generated Location: (2077:61,7 [76] )
|
class Person
{
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
index 5f4db4936967..6211b8625cfe 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs
@@ -22,15 +22,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
(__builder2) => {
__builder2.OpenElement(0, "div");
- __builder2.AddContent(1,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- person.Name
+#line (1,57)-(1,68) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(1, person.Name);
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
index aeeba7280ba7..1d7be90bd6e5 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt
@@ -5,6 +5,6 @@ Generated Location: (586:17,2 [47] )
Source Location: (73:0,73 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|; |
-Generated Location: (1221:37,73 [2] )
+Generated Location: (1144:35,73 [2] )
|; |
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
index bd3cd885b86e..45bc1b263857 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.codegen.cs
@@ -13,35 +13,24 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
- __builder.AddContent(0,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderPerson((person) =>
-
-#line default
-#line hidden
-#nullable disable
- (__builder2) => {
- __builder2.OpenElement(1, "div");
- __builder2.AddContent(2,
+#line (1,2)-(1,27) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(0, RenderPerson((person) => (__builder2) => {
+ __builder2.OpenElement(1, "div");
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- person.Name
+#line (1,34)-(1,45) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(2, person.Name);
#line default
#line hidden
#nullable disable
- );
- __builder2.CloseElement();
- }
-#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- )
+ __builder2.CloseElement();
+}
+));
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
index f75add9cec46..169ca5861607 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_InImplicitExpression/TestComponent.mappings.txt
@@ -7,7 +7,7 @@ Source Location: (60:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml)
object RenderPerson(RenderFragment p) => null;
|
-Generated Location: (1385:48,7 [138] )
+Generated Location: (1096:37,7 [138] )
|
class Person
{
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
index 7a0e0e8c038e..6ba9786c3d49 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.codegen.cs
@@ -23,15 +23,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
(__builder2) => {
__builder2.OpenElement(0, "div");
- __builder2.AddContent(1,
#nullable restore
-#line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
- person.Name
+#line (2,51)-(2,62) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(1, person.Name);
#line default
#line hidden
#nullable disable
- );
__builder2.CloseElement();
}
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
index 41e5e233b5eb..c096a6b34608 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InCodeBlock/TestComponent.mappings.txt
@@ -8,7 +8,7 @@ Generated Location: (586:17,2 [45] )
Source Location: (71:1,67 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|;
|
-Generated Location: (1207:38,67 [3] )
+Generated Location: (1136:36,67 [3] )
|;
|
@@ -19,7 +19,7 @@ Source Location: (84:3,7 [76] x:\dir\subdir\Test\TestComponent.cshtml)
public string Name { get; set; }
}
|
-Generated Location: (1386:47,7 [76] )
+Generated Location: (1315:45,7 [76] )
|
class Person
{
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
index d5b8baf16f0c..fc489ba26efd 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.codegen.cs
@@ -13,35 +13,24 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
- __builder.AddContent(0,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderPerson((person) =>
-
-#line default
-#line hidden
-#nullable disable
- (__builder2) => {
- __builder2.OpenElement(1, "div");
- __builder2.AddContent(2,
+#line (1,3)-(1,28) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(0, RenderPerson((person) => (__builder2) => {
+ __builder2.OpenElement(1, "div");
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- person.Name
+#line (1,35)-(1,46) 25 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder2.AddContent(2, person.Name);
#line default
#line hidden
#nullable disable
- );
- __builder2.CloseElement();
- }
-#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- )
+ __builder2.CloseElement();
+}
+));
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
index ed8cc2061958..eafe1098f379 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_InExplicitExpression/TestComponent.mappings.txt
@@ -7,7 +7,7 @@ Source Location: (62:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml)
object RenderPerson(RenderFragment p) => null;
|
-Generated Location: (1388:48,7 [138] )
+Generated Location: (1096:37,7 [138] )
|
class Person
{
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs
index 5f6d44c0e604..9a4129d39841 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.codegen.cs
@@ -13,25 +13,16 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
- __builder.AddContent(0,
#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- RenderPerson(
-
-#line default
-#line hidden
-#nullable disable
- (__builder2) => {
- __builder2.AddMarkupContent(1, "HI
");
- }
-#nullable restore
-#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
- )
+#line (1,2)-(1,15) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(0, RenderPerson((__builder2) => {
+ __builder2.AddMarkupContent(1, "HI
");
+}
+));
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
#nullable restore
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt
index a196ca0047f6..3754c123a0b6 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_NonGeneric_InImplicitExpression/TestComponent.mappings.txt
@@ -2,7 +2,7 @@ Source Location: (38:1,7 [54] x:\dir\subdir\Test\TestComponent.cshtml)
|
object RenderPerson(RenderFragment p) => null;
|
-Generated Location: (1093:38,7 [54] )
+Generated Location: (892:29,7 [54] )
|
object RenderPerson(RenderFragment p) => null;
|
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs
index 5dfe18db342c..603289abb337 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs
@@ -32,15 +32,13 @@ protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Renderin
#nullable disable
__builder.OpenElement(0, "p");
__builder.AddContent(1, "Output: ");
- __builder.AddContent(2,
#nullable restore
-#line 7 "x:\dir\subdir\Test\TestComponent.cshtml"
- output
+#line (7,17)-(7,23) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, output);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
}
#pragma warning restore 1998
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs
index 0b28745c52b7..93db78c5cbb5 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs
@@ -36,15 +36,13 @@ void RenderChildComponent(RenderTreeBuilder __builder)
#nullable disable
__builder.OpenElement(0, "p");
__builder.AddContent(1, "Output: ");
- __builder.AddContent(2,
#nullable restore
-#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
- output
+#line (9,21)-(9,27) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, output);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
#nullable restore
#line 10 "x:\dir\subdir\Test\TestComponent.cshtml"
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt
index d22c11086aa2..30cd9feaa88e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt
@@ -18,7 +18,7 @@ Generated Location: (810:26,7 [213] )
Source Location: (305:9,0 [7] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1459:50,0 [7] )
+Generated Location: (1434:48,0 [7] )
| }
|
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
index f5ef41e3b810..5071dbd8290e 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.codegen.cs
@@ -14,15 +14,13 @@ public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBa
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.AddMarkupContent(0, "Hello
\r\n\r\n");
- __builder.AddContent(1,
#nullable restore
-#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
- "My value"
+#line (3,3)-(3,13) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(1, "My value");
#line default
#line hidden
#nullable disable
- );
}
#pragma warning restore 1998
}
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
index d5d4bdcc4427..dd826c27a3e4 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs
@@ -41,15 +41,13 @@ void MyMethod(RenderTreeBuilder __builder)
#line hidden
#nullable disable
__builder.OpenElement(1, "li");
- __builder.AddContent(2,
#nullable restore
-#line 9 "x:\dir\subdir\Test\TestComponent.cshtml"
- i
+#line (9,22)-(9,23) 24 "x:\dir\subdir\Test\TestComponent.cshtml"
+__builder.AddContent(2, i);
#line default
#line hidden
#nullable disable
- );
__builder.CloseElement();
#nullable restore
#line 11 "x:\dir\subdir\Test\TestComponent.cshtml"
diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
index 60b4af48949a..1121e096023a 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt
@@ -21,14 +21,14 @@ Generated Location: (1041:36,13 [46] )
Source Location: (256:10,0 [15] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1474:55,0 [15] )
+Generated Location: (1448:53,0 [15] )
| }
|
Source Location: (286:12,0 [7] x:\dir\subdir\Test\TestComponent.cshtml)
| }
|
-Generated Location: (1645:63,0 [7] )
+Generated Location: (1619:61,0 [7] )
| }
|
diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/RazorProjectEngineBuilderExtensions.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/RazorProjectEngineBuilderExtensions.cs
index aa07cd9cf6ad..78ebb5be6324 100644
--- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/RazorProjectEngineBuilderExtensions.cs
+++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/RazorProjectEngineBuilderExtensions.cs
@@ -89,6 +89,11 @@ public void Configure(RazorCodeGenerationOptionsBuilder options)
// This is a useful optimization but isn't supported by older framework versions
options.OmitMinimizedComponentAttributeValues = true;
}
+
+ if (CSharpLanguageVersion >= LanguageVersion.CSharp10)
+ {
+ options.UseEnhancedLinePragma = true;
+ }
}
}
}