Reviving support for instrumentation in CSharpCodeVisitor

Fixes #42
This commit is contained in:
Pranav K 2014-09-08 12:45:50 -07:00
parent 131c973853
commit 11ee402eec
33 changed files with 934 additions and 54 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
@ -144,7 +145,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
Write(String.Format("using {0}", name));
if(endLine)
if (endLine)
{
WriteLine(";");
}
@ -353,35 +354,35 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
switch (literal[i])
{
case '\r':
Write("\\r");
break;
case '\t':
Write("\\t");
break;
case '\"':
Write("\\\"");
break;
case '\'':
Write("\\\'");
break;
case '\\':
Write("\\\\");
break;
case '\0':
Write("\\\0");
break;
case '\n':
Write("\\n");
break;
case '\u2028':
case '\u2029':
Write("\\u");
Write(((int)literal[i]).ToString("X4", CultureInfo.InvariantCulture));
break;
default:
Write(literal[i].ToString());
break;
case '\r':
Write("\\r");
break;
case '\t':
Write("\\t");
break;
case '\"':
Write("\\\"");
break;
case '\'':
Write("\\\'");
break;
case '\\':
Write("\\\\");
break;
case '\0':
Write("\\\0");
break;
case '\n':
Write("\\n");
break;
case '\u2028':
case '\u2029':
Write("\\u");
Write(((int)literal[i]).ToString("X4", CultureInfo.InvariantCulture));
break;
default:
Write(literal[i].ToString());
break;
}
if (i > 0 && i % 80 == 0)
{
@ -403,5 +404,21 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
}
Write("\"");
}
public void WriteStartInstrumentationContext(CodeGeneratorContext context, SyntaxTreeNode syntaxNode, bool isLiteral)
{
WriteStartMethodInvocation(context.Host.GeneratedClassContext.BeginContextMethodName);
Write(syntaxNode.Start.AbsoluteIndex.ToString(CultureInfo.InvariantCulture));
WriteParameterSeparator();
Write(syntaxNode.Length.ToString(CultureInfo.InvariantCulture));
WriteParameterSeparator();
Write(isLiteral ? "true" : "false");
WriteEndMethodInvocation();
}
public void WriteEndInstrumentationContext(CodeGeneratorContext context)
{
WriteMethodInvocation(context.Host.GeneratedClassContext.EndContextMethodName);
}
}
}

View File

@ -59,7 +59,14 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
return;
}
// TODO: Add instrumentation
var generateInstrumentation = ShouldGenerateInstrumentationForExpressions();
if (generateInstrumentation)
{
// Add a non-literal context call (non-literal because the expanded URL will not match the source
// character-by-character)
Writer.WriteStartInstrumentationContext(Context, chunk.Association, isLiteral: false);
}
if (!String.IsNullOrEmpty(chunk.Url) && !Context.Host.DesignTimeMode)
{
@ -86,6 +93,11 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
Writer.WriteEndMethodInvocation();
}
}
if (generateInstrumentation)
{
Writer.WriteEndInstrumentationContext(Context);
}
}
protected override void Visit(LiteralChunk chunk)
@ -95,7 +107,10 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
return;
}
// TODO: Add instrumentation
if (Context.Host.EnableInstrumentation)
{
Writer.WriteStartInstrumentationContext(Context, chunk.Association, isLiteral: true);
}
if (!String.IsNullOrEmpty(chunk.Text) && !Context.Host.DesignTimeMode)
{
@ -114,13 +129,14 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
.WriteEndMethodInvocation();
}
// TODO: Add instrumentation
if (Context.Host.EnableInstrumentation)
{
Writer.WriteEndInstrumentationContext(Context);
}
}
protected override void Visit(ExpressionBlockChunk chunk)
{
// TODO: Handle instrumentation
if (Context.Host.DesignTimeMode)
{
RenderDesignTimeExpressionBlockChunk(chunk);
@ -280,21 +296,19 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
var currentTargetWriterName = Context.TargetWriterName;
Context.TargetWriterName = TemplateWriterName;
using (Writer.BuildLambda(endLine: false, parameterNames: TemplateWriterName))
{
Accept(chunk.Children);
}
Context.TargetWriterName = currentTargetWriterName;
Writer.WriteEndMethodInvocation(endLine: false);
Writer.WriteEndMethodInvocation();
}
public void RenderDesignTimeExpressionBlockChunk(ExpressionBlockChunk chunk)
{
// TODO: Handle instrumentation
var firstChild = (ExpressionChunk)chunk.Children.FirstOrDefault();
if (firstChild != null)
@ -329,7 +343,28 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
public void RenderRuntimeExpressionBlockChunk(ExpressionBlockChunk chunk)
{
// TODO: Handle instrumentation
var generateInstrumentation = ShouldGenerateInstrumentationForExpressions();
Span contentSpan = null;
if (generateInstrumentation)
{
// For expression chunks, such as @value, @(value) etc, pick the first Code or Markup span
// from the expression (in this case "value") and use that to calculate the length. This works
// accurately for most parts. The scenarios that don't work are
// (a) Expressions with inline comments (e.g. @(a @* comment *@ b)) - these have multiple code spans
// (b) Expressions with inline templates (e.g. @Foo(@<p>Hello world</p>)).
// Tracked via https://github.com/aspnet/Razor/issues/153
var block = (Block)chunk.Association;
contentSpan = block.Children
.OfType<Span>()
.FirstOrDefault(s => s.Kind == SpanKind.Code || s.Kind == SpanKind.Markup);
if (contentSpan != null)
{
Writer.WriteStartInstrumentationContext(Context, contentSpan, isLiteral: false);
}
}
if (Context.ExpressionRenderingMode == ExpressionRenderingMode.InjectCode)
{
@ -353,6 +388,11 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
Writer.WriteEndMethodInvocation()
.WriteLine();
}
if (contentSpan != null)
{
Writer.WriteEndInstrumentationContext(Context);
}
}
public void CreateExpressionCodeMapping(string code, Chunk chunk)
@ -385,5 +425,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
Writer.Write(code);
}
}
private bool ShouldGenerateInstrumentationForExpressions()
{
// Only generate instrumentation for expression blocks if instrumentation is enabled and we're generating a
// "Write(<expression>)" statement.
return Context.Host.EnableInstrumentation &&
Context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput;
}
}
}

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
namespace Microsoft.AspNet.Razor.Generator.Compiler
@ -40,9 +41,22 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
public void AddLiteralChunk(string literal, SyntaxTreeNode association)
{
if (_lastChunk is LiteralChunk)
// If the previous chunk was also a LiteralChunk, append the content of the current node to the previous one.
var literalChunk = _lastChunk as LiteralChunk;
if (literalChunk != null)
{
((LiteralChunk)_lastChunk).Text += literal;
// Literal chunks are always associated with Spans
var lastSpan = (Span)literalChunk.Association;
var currentSpan = (Span)association;
var builder = new SpanBuilder(lastSpan);
foreach (var symbol in currentSpan.Symbols)
{
builder.Accept(symbol);
}
literalChunk.Association = builder.Build();
literalChunk.Text += literal;
}
else
{

View File

@ -393,16 +393,14 @@ namespace Microsoft.AspNet.Razor.Test.Generator
RunTest("Helpers", baselineName: "Helpers.Instance", hostConfig: h => h.StaticHelpers = false);
}
// TODO: This should be re-added once instrumentation support has been added
//[Fact]
//public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
//{
// RunTest("Instrumented", hostConfig: host =>
// {
// host.EnableInstrumentation = true;
// host.InstrumentedSourceFilePath = String.Format("~/{0}.cshtml", host.DefaultClassName);
// });
//}
[Fact]
public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
{
RunTest("Instrumented", hostConfig: host =>
{
host.InstrumentedSourceFilePath = string.Format("~/{0}.cshtml", host.DefaultClassName);
});
}
[Fact]
public void CSharpCodeGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes()

View File

@ -0,0 +1,79 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
using System.Linq;
using Xunit;
namespace Microsoft.AspNet.Razor
{
public class CodeTreeBuilderTest
{
[Fact]
public void AddLiteralChunk_AddsChunkToCodeTree()
{
// Arrange
var spanFactory = SpanFactory.CreateCsHtml();
var previousSpan = spanFactory.EmptyHtml().Builder.Build();
var builder = new CodeTreeBuilder();
// Act
builder.AddLiteralChunk("some text", previousSpan);
// Assert
var chunk = Assert.Single(builder.CodeTree.Chunks);
var literalChunk = Assert.IsType<LiteralChunk>(chunk);
Assert.Equal("some text", literalChunk.Text);
Assert.Same(previousSpan, literalChunk.Association);
}
[Fact]
public void AddLiteralChunk_AppendsToPreviousChunk_IfChunkWasLiteral()
{
// Arrange
var spanFactory = SpanFactory.CreateCsHtml();
var previousSpan = spanFactory.Markup("<a>").Builder.Build();
var newSpan = spanFactory.Markup("<p>").Builder.Build();
var builder = new CodeTreeBuilder();
// Act
builder.AddLiteralChunk("<a>", previousSpan);
builder.AddLiteralChunk("<p>", newSpan);
// Assert
var chunk = Assert.Single(builder.CodeTree.Chunks);
var literalChunk = Assert.IsType<LiteralChunk>(chunk);
Assert.Equal("<a><p>", literalChunk.Text);
var span = Assert.IsType<Span>(literalChunk.Association);
Assert.Equal(previousSpan.Symbols.Concat(newSpan.Symbols), span.Symbols);
}
[Fact]
public void AddLiteralChunk_AddsChunkToCodeTree_IfPreviousChunkWasNotLiteral()
{
// Arrange
var spanFactory = SpanFactory.CreateCsHtml();
var codeSpan = spanFactory.Code("int a = 10;")
.AsStatement()
.Builder.Build();
var literalSpan = spanFactory.Markup("<p>").Builder.Build();
var builder = new CodeTreeBuilder();
// Act
builder.AddStatementChunk("int a = 10;", codeSpan);
builder.AddLiteralChunk("<p>", literalSpan);
// Assert
var chunks = builder.CodeTree.Chunks;
Assert.Equal(2, chunks.Count);
var statementChunk = Assert.IsType<StatementChunk>(chunks[0]);
Assert.Equal("int a = 10;", statementChunk.Code);
Assert.Same(codeSpan, statementChunk.Association);
var literalChunk = Assert.IsType<LiteralChunk>(chunks[1]);
Assert.Equal("<p>", literalChunk.Text);
Assert.Same(literalSpan, literalChunk.Association);
}
}
}

View File

@ -118,8 +118,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator
"WriteLiteralTo",
"Template",
"DefineSection",
"BeginContext",
"EndContext")
"Instrumentation.BeginContext",
"Instrumentation.EndContext")
{
LayoutPropertyName = "Layout",
ResolveUrlMethodName = "Href"
@ -130,6 +130,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
host.IsIndentingWithTabs = withTabs;
host.EnableInstrumentation = true;
RazorTemplateEngine engine = new RazorTemplateEngine(host);

View File

@ -22,8 +22,11 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(91, 100, true);
WriteLiteral("\r\n<section>\r\n <h1>Basic Asynchronous Expression Test</h1>\r\n <p>Basic Asynch" +
"ronous Expression: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(192, 11, false);
Write(
#line 10 "Await.cshtml"
await Foo()
@ -32,7 +35,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(203, 42, true);
WriteLiteral("</p>\r\n <p>Basic Asynchronous Template: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(247, 11, false);
Write(
#line 11 "Await.cshtml"
await Foo()
@ -41,14 +48,20 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(259, 43, true);
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement: ");
Instrumentation.EndContext();
#line 12 "Await.cshtml"
await Foo();
#line default
#line hidden
Instrumentation.BeginContext(319, 54, true);
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement Nested: <b>");
Instrumentation.EndContext();
Instrumentation.BeginContext(376, 11, false);
Write(
#line 13 "Await.cshtml"
await Foo()
@ -57,14 +70,20 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(387, 5, true);
WriteLiteral("</b> ");
Instrumentation.EndContext();
#line 13 "Await.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(393, 54, true);
WriteLiteral("</p>\r\n <p>Basic Incomplete Asynchronous Statement: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(448, 5, false);
Write(
#line 14 "Await.cshtml"
await
@ -73,8 +92,12 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(453, 124, true);
WriteLiteral("</p>\r\n</section>\r\n\r\n<section>\r\n <h1>Advanced Asynchronous Expression Test</h1>" +
"\r\n <p>Advanced Asynchronous Expression: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(578, 15, false);
Write(
#line 19 "Await.cshtml"
await Foo(1, 2)
@ -83,7 +106,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(593, 56, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Expression Extended: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(650, 19, false);
Write(
#line 20 "Await.cshtml"
await Foo.Bar(1, 2)
@ -92,7 +119,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(669, 45, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Template: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(716, 22, false);
Write(
#line 21 "Await.cshtml"
await Foo("bob", true)
@ -101,21 +132,29 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(739, 46, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement: ");
Instrumentation.EndContext();
#line 22 "Await.cshtml"
await Foo(something, hello: "world");
#line default
#line hidden
Instrumentation.BeginContext(827, 55, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement Extended: ");
Instrumentation.EndContext();
#line 23 "Await.cshtml"
await Foo.Bar(1, 2)
#line default
#line hidden
Instrumentation.BeginContext(906, 57, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement Nested: <b>");
Instrumentation.EndContext();
Instrumentation.BeginContext(966, 27, false);
Write(
#line 24 "Await.cshtml"
await Foo(boolValue: false)
@ -124,14 +163,20 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(993, 5, true);
WriteLiteral("</b> ");
Instrumentation.EndContext();
#line 24 "Await.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(999, 57, true);
WriteLiteral("</p>\r\n <p>Advanced Incomplete Asynchronous Statement: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(1057, 19, false);
Write(
#line 25 "Await.cshtml"
await ("wrrronggg")
@ -140,7 +185,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(1076, 16, true);
WriteLiteral("</p>\r\n</section>");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -20,14 +20,19 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(21, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
#line 5 "Blocks.cshtml"
while(i <= 10) {
#line default
#line hidden
Instrumentation.BeginContext(44, 23, true);
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 1, false);
Write(
#line 6 "Blocks.cshtml"
i
@ -36,7 +41,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 7 "Blocks.cshtml"
i += 1;
}
@ -44,21 +52,27 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(93, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 10 "Blocks.cshtml"
if(i == 11) {
#line default
#line hidden
Instrumentation.BeginContext(111, 31, true);
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 12 "Blocks.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(145, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 14 "Blocks.cshtml"
switch(i) {
case 11:
@ -66,7 +80,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(175, 46, true);
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 17 "Blocks.cshtml"
break;
default:
@ -74,7 +90,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(251, 39, true);
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
Instrumentation.EndContext();
#line 20 "Blocks.cshtml"
break;
}
@ -82,14 +100,19 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(309, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 23 "Blocks.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
Instrumentation.BeginContext(347, 29, true);
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(378, 1, false);
Write(
#line 24 "Blocks.cshtml"
j
@ -98,28 +121,38 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(380, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 25 "Blocks.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(389, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 27 "Blocks.cshtml"
try {
#line default
#line hidden
Instrumentation.BeginContext(399, 41, true);
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
Instrumentation.EndContext();
#line 29 "Blocks.cshtml"
} catch(Exception ex) {
#line default
#line hidden
Instrumentation.BeginContext(465, 33, true);
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(500, 10, false);
Write(
#line 30 "Blocks.cshtml"
ex.Message
@ -128,14 +161,20 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 31 "Blocks.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(520, 14, true);
WriteLiteral("\r\n<p>i is now ");
Instrumentation.EndContext();
Instrumentation.BeginContext(535, 1, false);
Write(
#line 33 "Blocks.cshtml"
i
@ -144,14 +183,19 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(536, 8, true);
WriteLiteral("</p>\r\n\r\n");
Instrumentation.EndContext();
#line 35 "Blocks.cshtml"
lock(new object()) {
#line default
#line hidden
Instrumentation.BeginContext(567, 53, true);
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
Instrumentation.EndContext();
#line 37 "Blocks.cshtml"
}

View File

@ -21,7 +21,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(46, 28, true);
WriteLiteral(" <a href=\"Foo\" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 74), Tuple.Create("\"", 86),
Tuple.Create(Tuple.Create("", 82), Tuple.Create<System.Object, System.Int32>(
#line 5 "ConditionalAttributes.cshtml"
@ -30,7 +32,9 @@ namespace TestOutput
#line default
#line hidden
, 82), false));
Instrumentation.BeginContext(87, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 98), Tuple.Create("\"", 114), Tuple.Create(Tuple.Create("", 106), Tuple.Create("foo", 106), true),
Tuple.Create(Tuple.Create(" ", 109), Tuple.Create<System.Object, System.Int32>(
#line 6 "ConditionalAttributes.cshtml"
@ -39,7 +43,9 @@ namespace TestOutput
#line default
#line hidden
, 110), false));
Instrumentation.BeginContext(115, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 126), Tuple.Create("\"", 142),
Tuple.Create(Tuple.Create("", 134), Tuple.Create<System.Object, System.Int32>(
#line 7 "ConditionalAttributes.cshtml"
@ -48,7 +54,9 @@ namespace TestOutput
#line default
#line hidden
, 134), false), Tuple.Create(Tuple.Create(" ", 138), Tuple.Create("foo", 139), true));
Instrumentation.BeginContext(143, 31, true);
WriteLiteral(" />\r\n <input type=\"checkbox\"");
Instrumentation.EndContext();
WriteAttribute("checked", Tuple.Create(" checked=\"", 174), Tuple.Create("\"", 187),
Tuple.Create(Tuple.Create("", 184), Tuple.Create<System.Object, System.Int32>(
#line 8 "ConditionalAttributes.cshtml"
@ -57,7 +65,9 @@ namespace TestOutput
#line default
#line hidden
, 184), false));
Instrumentation.BeginContext(188, 31, true);
WriteLiteral(" />\r\n <input type=\"checkbox\"");
Instrumentation.EndContext();
WriteAttribute("checked", Tuple.Create(" checked=\"", 219), Tuple.Create("\"", 236), Tuple.Create(Tuple.Create("", 229), Tuple.Create("foo", 229), true),
Tuple.Create(Tuple.Create(" ", 232), Tuple.Create<System.Object, System.Int32>(
#line 9 "ConditionalAttributes.cshtml"
@ -66,7 +76,9 @@ namespace TestOutput
#line default
#line hidden
, 233), false));
Instrumentation.BeginContext(237, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 248), Tuple.Create("\"", 281),
Tuple.Create(Tuple.Create("", 256), Tuple.Create<System.Object, System.Int32>(new Template((__razor_attribute_value_writer) => {
#line 10 "ConditionalAttributes.cshtml"
@ -75,6 +87,7 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(276, 3, false);
WriteTo(__razor_attribute_value_writer,
#line 10 "ConditionalAttributes.cshtml"
cls
@ -83,6 +96,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
#line 10 "ConditionalAttributes.cshtml"
}
@ -91,9 +105,13 @@ namespace TestOutput
}
), 256), false));
Instrumentation.BeginContext(282, 11, true);
WriteLiteral(" />\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 293), Tuple.Create("\"", 305), Tuple.Create(Tuple.Create("", 300), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 300), false));
Instrumentation.BeginContext(306, 16, true);
WriteLiteral(" />\r\n <script");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 322), Tuple.Create("\"", 373),
Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(
#line 12 "ConditionalAttributes.cshtml"
@ -102,7 +120,9 @@ namespace TestOutput
#line default
#line hidden
, 328), false));
Instrumentation.BeginContext(374, 46, true);
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 420), Tuple.Create("\"", 487),
Tuple.Create(Tuple.Create("", 426), Tuple.Create<System.Object, System.Int32>(
#line 13 "ConditionalAttributes.cshtml"
@ -111,8 +131,10 @@ namespace TestOutput
#line default
#line hidden
, 426), false));
Instrumentation.BeginContext(488, 152, true);
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script src=\"http://ajax.aspnetcdn.com/aja" +
"x/jquery.ui/1.8.16/jquery-ui.min.js\" type=\"text/javascript\"></script>\r\n");
Instrumentation.EndContext();
#line 15 "ConditionalAttributes.cshtml"
#line default

View File

@ -13,7 +13,10 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(0, 8, true);
WriteLiteral("1 + 1 = ");
Instrumentation.EndContext();
Instrumentation.BeginContext(10, 3, false);
Write(
#line 1 "ExplicitExpression.cshtml"
1+1
@ -22,6 +25,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -21,7 +21,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(54, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
#line 6 "ExpressionsInCode.cshtml"
if(foo != null) {
@ -29,6 +31,7 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(83, 3, false);
Write(
#line 7 "ExpressionsInCode.cshtml"
foo
@ -37,6 +40,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
#line 7 "ExpressionsInCode.cshtml"
} else {
@ -44,14 +48,18 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(98, 25, true);
WriteLiteral(" <p>Foo is Null!</p>\r\n");
Instrumentation.EndContext();
#line 10 "ExpressionsInCode.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(126, 7, true);
WriteLiteral("\r\n<p>\r\n");
Instrumentation.EndContext();
#line 13 "ExpressionsInCode.cshtml"
if(!String.IsNullOrEmpty(bar)) {
@ -59,6 +67,7 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(174, 21, false);
Write(
#line 14 "ExpressionsInCode.cshtml"
bar.Replace("F", "B")
@ -67,6 +76,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
#line 14 "ExpressionsInCode.cshtml"
}
@ -74,7 +84,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(201, 4, true);
WriteLiteral("</p>");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -28,8 +28,13 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(19, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(140, 26, true);
WriteLiteral("\r\nHere\'s a random number: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(167, 11, false);
Write(
#line 12 "FunctionsBlock.cshtml"
RandomInt()
@ -38,6 +43,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -28,8 +28,13 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(19, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(125, 26, true);
WriteLiteral("\r\nHere\'s a random number: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(152, 11, false);
Write(
#line 12 "FunctionsBlock_Tabs.cshtml"
RandomInt()
@ -38,6 +43,7 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(48, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
s
@ -28,7 +31,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 4 "Helpers.cshtml"
#line default
@ -56,7 +62,10 @@ Italic(string s) {
#line default
#line hidden
Instrumentation.BeginContext(128, 8, true);
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(137, 1, false);
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
s
@ -65,7 +74,10 @@ Italic(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(138, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
Instrumentation.EndContext();
#line 9 "Helpers.cshtml"
#line default
@ -87,8 +99,13 @@ Italic(string s) {
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(76, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(148, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 13, false);
Write(
#line 11 "Helpers.cshtml"
Bold("Hello")
@ -97,6 +114,7 @@ Italic(string s) {
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(48, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
s
@ -28,7 +31,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 4 "Helpers.cshtml"
#line default
@ -56,7 +62,10 @@ Italic(string s) {
#line default
#line hidden
Instrumentation.BeginContext(128, 8, true);
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(137, 1, false);
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
s
@ -65,7 +74,10 @@ Italic(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(138, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
Instrumentation.EndContext();
#line 9 "Helpers.cshtml"
#line default
@ -87,8 +99,13 @@ Italic(string s) {
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(76, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(148, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 13, false);
Write(
#line 11 "Helpers.cshtml"
Bold("Hello")
@ -97,6 +114,7 @@ Italic(string s) {
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(48, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingCloseParen.cshtml"
s
@ -28,7 +31,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 4 "HelpersMissingCloseParen.cshtml"
#line default
@ -58,7 +64,9 @@ Italic(string s
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(76, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(48, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenBrace.cshtml"
s
@ -28,7 +31,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 4 "HelpersMissingOpenBrace.cshtml"
#line default
@ -57,7 +63,10 @@ Italic(string s)
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(76, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(106, 9, false);
Write(
#line 7 "HelpersMissingOpenBrace.cshtml"
Italic(s)
@ -66,6 +75,7 @@ Italic(string s)
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(48, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenParen.cshtml"
s
@ -28,7 +31,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 4 "HelpersMissingOpenParen.cshtml"
#line default
@ -57,7 +63,10 @@ Italic
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(76, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(95, 13, false);
Write(
#line 7 "HelpersMissingOpenParen.cshtml"
Bold("Hello")
@ -66,6 +75,7 @@ Italic
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -13,9 +13,13 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(0, 16, true);
WriteLiteral("<!-- \" -->\r\n<img");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41), Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png"), 22), false));
Instrumentation.BeginContext(42, 3, true);
WriteLiteral(" />");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -13,9 +13,13 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(0, 16, true);
WriteLiteral("<!-- \' -->\r\n<img");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41), Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png"), 22), false));
Instrumentation.BeginContext(42, 3, true);
WriteLiteral(" />");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -19,7 +19,10 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(33, 21, true);
WriteLiteral(" <p>This is item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(55, 1, false);
Write(
#line 2 "ImplicitExpression.cshtml"
i
@ -28,7 +31,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(56, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 3 "ImplicitExpression.cshtml"
}

View File

@ -30,7 +30,10 @@ using System
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(68, 30, true);
WriteLiteral("\r\n<p>Path\'s full type name is ");
Instrumentation.EndContext();
Instrumentation.BeginContext(99, 21, false);
Write(
#line 5 "Imports.cshtml"
typeof(Path).FullName
@ -39,7 +42,11 @@ using System
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(120, 40, true);
WriteLiteral("</p>\r\n<p>Foo\'s actual full type name is ");
Instrumentation.EndContext();
Instrumentation.BeginContext(161, 20, false);
Write(
#line 6 "Imports.cshtml"
typeof(Foo).FullName
@ -48,7 +55,10 @@ using System
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(181, 4, true);
WriteLiteral("</p>");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -13,6 +13,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(1, 5, false);
Write(
#line 1 "Inherits.cshtml"
foo()
@ -21,7 +22,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(6, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -18,7 +18,9 @@ Link(string link) {
#line default
#line hidden
Instrumentation.BeginContext(29, 6, true);
WriteLiteralTo(__razor_helper_writer, " <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 35), Tuple.Create("\"", 93),
Tuple.Create(Tuple.Create("", 42), Tuple.Create<System.Object, System.Int32>(new Template((__razor_attribute_value_writer) => {
#line 2 "InlineBlocks.cshtml"
@ -27,6 +29,7 @@ Link(string link) {
#line default
#line hidden
Instrumentation.BeginContext(63, 4, false);
WriteTo(__razor_attribute_value_writer,
#line 2 "InlineBlocks.cshtml"
link
@ -35,13 +38,16 @@ Link(string link) {
#line hidden
);
Instrumentation.EndContext();
#line 2 "InlineBlocks.cshtml"
} else {
#line default
#line hidden
Instrumentation.BeginContext(76, 3, true);
WriteLiteralTo(__razor_attribute_value_writer, " # ");
Instrumentation.EndContext();
#line 2 "InlineBlocks.cshtml"
}
@ -50,7 +56,9 @@ Link(string link) {
}
), 42), false));
Instrumentation.BeginContext(94, 5, true);
WriteLiteralTo(__razor_helper_writer, " />\r\n");
Instrumentation.EndContext();
#line 3 "InlineBlocks.cshtml"
#line default

View File

@ -0,0 +1,261 @@
namespace TestOutput
{
using System;
using System.Threading.Tasks;
public class Instrumented
{
public static Template
#line 1 "Instrumented.cshtml"
Strong(string s) {
#line default
#line hidden
return new Template((__razor_helper_writer) => {
#line 1 "Instrumented.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(28, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(41, 1, false);
WriteTo(__razor_helper_writer,
#line 2 "Instrumented.cshtml"
s
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(42, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 3 "Instrumented.cshtml"
#line default
#line hidden
}
);
#line 3 "Instrumented.cshtml"
}
#line default
#line hidden
#line hidden
public Instrumented()
{
}
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(56, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 5 "Instrumented.cshtml"
int i = 1;
var foo =
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(93, 10, true);
WriteLiteralTo(__razor_template_writer, "<p>Bar</p>");
Instrumentation.EndContext();
}
)
#line 7 "Instrumented.cshtml"
;
#line default
#line hidden
Instrumentation.BeginContext(106, 43, true);
WriteLiteral(" Hello, World\r\n <p>Hello, World</p>\r\n");
Instrumentation.EndContext();
#line 10 "Instrumented.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(152, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
#line 12 "Instrumented.cshtml"
while(i <= 10) {
#line default
#line hidden
Instrumentation.BeginContext(175, 23, true);
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(200, 1, false);
Write(
#line 13 "Instrumented.cshtml"
i
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(202, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 14 "Instrumented.cshtml"
i += 1;
}
#line default
#line hidden
Instrumentation.BeginContext(224, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 17 "Instrumented.cshtml"
if(i == 11) {
#line default
#line hidden
Instrumentation.BeginContext(242, 31, true);
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 19 "Instrumented.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(276, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 21 "Instrumented.cshtml"
switch(i) {
case 11:
#line default
#line hidden
Instrumentation.BeginContext(306, 46, true);
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 24 "Instrumented.cshtml"
break;
default:
#line default
#line hidden
Instrumentation.BeginContext(382, 39, true);
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
Instrumentation.EndContext();
#line 27 "Instrumented.cshtml"
break;
}
#line default
#line hidden
Instrumentation.BeginContext(440, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 30 "Instrumented.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
Instrumentation.BeginContext(478, 29, true);
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(509, 1, false);
Write(
#line 31 "Instrumented.cshtml"
j
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 32 "Instrumented.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(520, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 34 "Instrumented.cshtml"
try {
#line default
#line hidden
Instrumentation.BeginContext(530, 41, true);
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
Instrumentation.EndContext();
#line 36 "Instrumented.cshtml"
} catch(Exception ex) {
#line default
#line hidden
Instrumentation.BeginContext(596, 33, true);
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(631, 10, false);
Write(
#line 37 "Instrumented.cshtml"
ex.Message
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(642, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 38 "Instrumented.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(651, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 40 "Instrumented.cshtml"
lock(new object()) {
#line default
#line hidden
Instrumentation.BeginContext(676, 53, true);
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
Instrumentation.EndContext();
#line 42 "Instrumented.cshtml"
}
#line default
#line hidden
}
#pragma warning restore 1998
}
}

View File

@ -20,7 +20,10 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(40, 27, true);
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 12, false);
Write(
#line 3 "MarkupInCodeBlock.cshtml"
i.ToString()
@ -29,14 +32,19 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(82, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 4 "MarkupInCodeBlock.cshtml"
}
#line default
#line hidden
Instrumentation.BeginContext(96, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -26,7 +26,10 @@ Italic(string s) {
#line default
#line hidden
Instrumentation.BeginContext(142, 8, true);
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 7, false);
WriteTo(__razor_helper_writer,
#line 7 "NestedHelpers.cshtml"
Bold(s)
@ -35,7 +38,10 @@ Italic(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(158, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
Instrumentation.EndContext();
#line 8 "NestedHelpers.cshtml"
#line default
@ -63,7 +69,10 @@ Bold(string s) {
#line default
#line hidden
Instrumentation.BeginContext(106, 16, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(123, 1, false);
WriteTo(__razor_helper_writer,
#line 5 "NestedHelpers.cshtml"
s
@ -72,7 +81,10 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(124, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
Instrumentation.EndContext();
#line 6 "NestedHelpers.cshtml"
@ -95,7 +107,10 @@ Bold(string s) {
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(168, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(171, 15, false);
Write(
#line 10 "NestedHelpers.cshtml"
Italic("Hello")
@ -104,6 +119,7 @@ Bold(string s) {
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -20,14 +20,19 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(21, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
#line 5 ""
while(i <= 10) {
#line default
#line hidden
Instrumentation.BeginContext(44, 23, true);
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 1, false);
Write(
#line 6 ""
i
@ -36,7 +41,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 7 ""
i += 1;
}
@ -44,21 +52,27 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(93, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 10 ""
if(i == 11) {
#line default
#line hidden
Instrumentation.BeginContext(111, 31, true);
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 12 ""
}
#line default
#line hidden
Instrumentation.BeginContext(145, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 14 ""
switch(i) {
case 11:
@ -66,7 +80,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(175, 46, true);
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
Instrumentation.EndContext();
#line 17 ""
break;
default:
@ -74,7 +90,9 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(251, 39, true);
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
Instrumentation.EndContext();
#line 20 ""
break;
}
@ -82,14 +100,19 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(309, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 23 ""
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
Instrumentation.BeginContext(347, 29, true);
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(378, 1, false);
Write(
#line 24 ""
j
@ -98,28 +121,38 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(380, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 25 ""
}
#line default
#line hidden
Instrumentation.BeginContext(389, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 27 ""
try {
#line default
#line hidden
Instrumentation.BeginContext(399, 41, true);
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
Instrumentation.EndContext();
#line 29 ""
} catch(Exception ex) {
#line default
#line hidden
Instrumentation.BeginContext(465, 33, true);
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(500, 10, false);
Write(
#line 30 ""
ex.Message
@ -128,7 +161,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
Instrumentation.EndContext();
#line 31 ""
}
@ -142,7 +178,10 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(558, 12, true);
WriteLiteral("<p>i is now ");
Instrumentation.EndContext();
Instrumentation.BeginContext(571, 1, false);
Write(
#line 34 ""
i
@ -151,14 +190,19 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(572, 8, true);
WriteLiteral("</p>\r\n\r\n");
Instrumentation.EndContext();
#line 36 ""
lock(new object()) {
#line default
#line hidden
Instrumentation.BeginContext(603, 53, true);
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
Instrumentation.EndContext();
#line 38 ""
}

View File

@ -13,7 +13,9 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(0, 34, true);
WriteLiteral("\r\n<p>This should be shown</p>\r\n\r\n");
Instrumentation.EndContext();
#line 4 "RazorComments.cshtml"
@ -37,14 +39,19 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(232, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
#line 12 "RazorComments.cshtml"
var bar = "@* bar *@";
#line default
#line hidden
Instrumentation.BeginContext(263, 46, true);
WriteLiteral("\r\n<p>But this should show the comment syntax: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(310, 3, false);
Write(
#line 13 "RazorComments.cshtml"
bar
@ -53,7 +60,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(313, 8, true);
WriteLiteral("</p>\r\n\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(323, 1, false);
Write(
#line 15 "RazorComments.cshtml"
a
@ -67,7 +78,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(330, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -13,9 +13,13 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(0, 2, true);
WriteLiteral("<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 2), Tuple.Create("\"", 14), Tuple.Create(Tuple.Create("", 9), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 9), false));
Instrumentation.BeginContext(15, 12, true);
WriteLiteral(">Foo</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 27), Tuple.Create("\"", 56), Tuple.Create(Tuple.Create("", 34), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 34), false),
Tuple.Create(Tuple.Create("", 45), Tuple.Create<System.Object, System.Int32>(
#line 2 "ResolveUrl.cshtml"
@ -24,7 +28,10 @@ namespace TestOutput
#line default
#line hidden
, 45), false));
Instrumentation.BeginContext(57, 1, true);
WriteLiteral(">");
Instrumentation.EndContext();
Instrumentation.BeginContext(59, 12, false);
Write(
#line 2 "ResolveUrl.cshtml"
product.Name
@ -33,7 +40,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 8, true);
WriteLiteral("</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 79), Tuple.Create("\"", 115), Tuple.Create(Tuple.Create("", 86), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 86), false),
Tuple.Create(Tuple.Create("", 97), Tuple.Create<System.Object, System.Int32>(
#line 3 "ResolveUrl.cshtml"
@ -42,7 +52,9 @@ namespace TestOutput
#line default
#line hidden
, 97), false), Tuple.Create(Tuple.Create("", 108), Tuple.Create("/Detail", 108), true));
Instrumentation.BeginContext(116, 16, true);
WriteLiteral(">Details</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 132), Tuple.Create("\"", 187), Tuple.Create(Tuple.Create("", 139), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 139), false),
Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(
#line 4 "ResolveUrl.cshtml"
@ -51,16 +63,22 @@ namespace TestOutput
#line default
#line hidden
, 169), false), Tuple.Create(Tuple.Create("", 180), Tuple.Create("/Detail", 180), true));
Instrumentation.BeginContext(188, 19, true);
WriteLiteral(">Crazy Url!</a>\r\n\r\n");
Instrumentation.EndContext();
#line 6 "ResolveUrl.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(211, 16, true);
WriteLiteral(" \r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 233), Tuple.Create("\"", 245), Tuple.Create(Tuple.Create("", 240), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 240), false));
Instrumentation.BeginContext(246, 20, true);
WriteLiteral(">Foo</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 266), Tuple.Create("\"", 295), Tuple.Create(Tuple.Create("", 273), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 273), false),
Tuple.Create(Tuple.Create("", 284), Tuple.Create<System.Object, System.Int32>(
#line 9 "ResolveUrl.cshtml"
@ -69,7 +87,10 @@ namespace TestOutput
#line default
#line hidden
, 284), false));
Instrumentation.BeginContext(296, 1, true);
WriteLiteral(">");
Instrumentation.EndContext();
Instrumentation.BeginContext(298, 12, false);
Write(
#line 9 "ResolveUrl.cshtml"
product.Name
@ -78,7 +99,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(310, 16, true);
WriteLiteral("</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 326), Tuple.Create("\"", 362), Tuple.Create(Tuple.Create("", 333), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 333), false),
Tuple.Create(Tuple.Create("", 344), Tuple.Create<System.Object, System.Int32>(
#line 10 "ResolveUrl.cshtml"
@ -87,7 +111,9 @@ namespace TestOutput
#line default
#line hidden
, 344), false), Tuple.Create(Tuple.Create("", 355), Tuple.Create("/Detail", 355), true));
Instrumentation.BeginContext(363, 24, true);
WriteLiteral(">Details</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442), Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 394), false),
Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(
#line 11 "ResolveUrl.cshtml"
@ -96,17 +122,25 @@ namespace TestOutput
#line default
#line hidden
, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true));
Instrumentation.BeginContext(443, 23, true);
WriteLiteral(">Crazy Url!</a>\r\n \r\n");
Instrumentation.EndContext();
#line 13 "ResolveUrl.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(474, 4, true);
WriteLiteral("\r\n\r\n");
Instrumentation.EndContext();
DefineSection("Foo", new Template((__razor_template_writer) => {
Instrumentation.BeginContext(492, 8, true);
WriteLiteralTo(__razor_template_writer, "\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 500), Tuple.Create("\"", 512), Tuple.Create(Tuple.Create("", 507), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 507), false));
Instrumentation.BeginContext(513, 16, true);
WriteLiteralTo(__razor_template_writer, ">Foo</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 529), Tuple.Create("\"", 558), Tuple.Create(Tuple.Create("", 536), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 536), false),
Tuple.Create(Tuple.Create("", 547), Tuple.Create<System.Object, System.Int32>(
#line 17 "ResolveUrl.cshtml"
@ -115,7 +149,10 @@ namespace TestOutput
#line default
#line hidden
, 547), false));
Instrumentation.BeginContext(559, 1, true);
WriteLiteralTo(__razor_template_writer, ">");
Instrumentation.EndContext();
Instrumentation.BeginContext(561, 12, false);
WriteTo(__razor_template_writer,
#line 17 "ResolveUrl.cshtml"
product.Name
@ -124,7 +161,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(573, 12, true);
WriteLiteralTo(__razor_template_writer, "</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 585), Tuple.Create("\"", 621), Tuple.Create(Tuple.Create("", 592), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 592), false),
Tuple.Create(Tuple.Create("", 603), Tuple.Create<System.Object, System.Int32>(
#line 18 "ResolveUrl.cshtml"
@ -133,7 +173,9 @@ namespace TestOutput
#line default
#line hidden
, 603), false), Tuple.Create(Tuple.Create("", 614), Tuple.Create("/Detail", 614), true));
Instrumentation.BeginContext(622, 20, true);
WriteLiteralTo(__razor_template_writer, ">Details</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 642), Tuple.Create("\"", 697), Tuple.Create(Tuple.Create("", 649), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 649), false),
Tuple.Create(Tuple.Create("", 679), Tuple.Create<System.Object, System.Int32>(
#line 19 "ResolveUrl.cshtml"
@ -142,7 +184,9 @@ namespace TestOutput
#line default
#line hidden
, 679), false), Tuple.Create(Tuple.Create("", 690), Tuple.Create("/Detail", 690), true));
Instrumentation.BeginContext(698, 17, true);
WriteLiteralTo(__razor_template_writer, ">Crazy Url!</a>\r\n");
Instrumentation.EndContext();
}
));
}

View File

@ -20,14 +20,22 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(47, 33, true);
WriteLiteral("\r\n\r\n<div>This is in the Body>\r\n\r\n");
Instrumentation.EndContext();
DefineSection("Section2", new Template((__razor_template_writer) => {
Instrumentation.BeginContext(99, 39, true);
WriteLiteralTo(__razor_template_writer, "\r\n <div>This is in Section 2</div>\r\n");
Instrumentation.EndContext();
}
));
Instrumentation.BeginContext(141, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
DefineSection("Section1", new Template((__razor_template_writer) => {
Instrumentation.BeginContext(162, 39, true);
WriteLiteralTo(__razor_template_writer, "\r\n <div>This is in Section 1</div>\r\n");
Instrumentation.EndContext();
}
));
}

View File

@ -25,7 +25,9 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(280, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line 11 "Templates.cshtml"
Func<dynamic, object> foo =
@ -34,7 +36,10 @@ namespace TestOutput
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(325, 11, true);
WriteLiteralTo(__razor_template_writer, "This works ");
Instrumentation.EndContext();
Instrumentation.BeginContext(337, 4, false);
WriteTo(__razor_template_writer,
#line 12 "Templates.cshtml"
item
@ -43,7 +48,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(341, 1, true);
WriteLiteralTo(__razor_template_writer, "!");
Instrumentation.EndContext();
}
)
#line 12 "Templates.cshtml"
@ -53,6 +61,7 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(357, 7, false);
Write(
#line 13 "Templates.cshtml"
foo("")
@ -61,13 +70,17 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
#line 13 "Templates.cshtml"
#line default
#line hidden
Instrumentation.BeginContext(367, 10, true);
WriteLiteral("\r\n\r\n<ul>\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(379, 11, false);
Write(
#line 17 "Templates.cshtml"
Repeat(10,
@ -75,7 +88,10 @@ namespace TestOutput
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(391, 10, true);
WriteLiteralTo(__razor_template_writer, "<li>Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(402, 4, false);
WriteTo(__razor_template_writer,
#line 17 "Templates.cshtml"
item
@ -84,7 +100,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(406, 5, true);
WriteLiteralTo(__razor_template_writer, "</li>");
Instrumentation.EndContext();
}
)
#line 17 "Templates.cshtml"
@ -94,7 +113,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(413, 16, true);
WriteLiteral("\r\n</ul>\r\n\r\n<p>\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(430, 16, false);
Write(
#line 21 "Templates.cshtml"
Repeat(10,
@ -103,7 +126,10 @@ namespace TestOutput
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(448, 14, true);
WriteLiteralTo(__razor_template_writer, " This is line#");
Instrumentation.EndContext();
Instrumentation.BeginContext(463, 4, false);
WriteTo(__razor_template_writer,
#line 22 "Templates.cshtml"
item
@ -112,7 +138,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(467, 17, true);
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
Instrumentation.EndContext();
}
)
#line 23 "Templates.cshtml"
@ -122,7 +151,11 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(485, 20, true);
WriteLiteral("\r\n</p>\r\n\r\n<ul>\r\n ");
Instrumentation.EndContext();
Instrumentation.BeginContext(506, 11, false);
Write(
#line 27 "Templates.cshtml"
Repeat(10,
@ -130,7 +163,10 @@ namespace TestOutput
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(518, 20, true);
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(539, 4, false);
WriteTo(__razor_template_writer,
#line 28 "Templates.cshtml"
item
@ -139,7 +175,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(543, 2, true);
WriteLiteralTo(__razor_template_writer, "\r\n");
Instrumentation.EndContext();
#line 29 "Templates.cshtml"
@ -152,8 +191,10 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(574, 93, true);
WriteLiteralTo(__razor_template_writer, "\r\n <ul>\r\n <li>Child Items... ?</li>\r\n \r\n </ul" +
">\r\n </li>");
Instrumentation.EndContext();
}
)
#line 34 "Templates.cshtml"
@ -163,7 +204,10 @@ namespace TestOutput
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(715, 8, true);
WriteLiteral("\r\n</ul> ");
Instrumentation.EndContext();
}
#pragma warning restore 1998
}

View File

@ -0,0 +1,42 @@
@helper Strong(string s) {
<strong>@s</strong>
}
@{
int i = 1;
var foo = @<p>Bar</p>;
@:Hello, World
<p>Hello, World</p>
}
@while(i <= 10) {
<p>Hello from C#, #@(i)</p>
i += 1;
}
@if(i == 11) {
<p>We wrote 10 lines!</p>
}
@switch(i) {
case 11:
<p>No really, we wrote 10 lines!</p>
break;
default:
<p>Actually, we didn't...</p>
break;
}
@for(int j = 1; j <= 10; j += 2) {
<p>Hello again from C#, #@(j)</p>
}
@try {
<p>That time, we wrote 5 lines!</p>
} catch(Exception ex) {
<p>Oh no! An error occurred: @(ex.Message)</p>
}
@lock(new object()) {
<p>This block is locked, for your security!</p>
}