This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change string rendering to be chunked.
- Roslyn currently has an issue where too large of strings result in out of memory exceptions at compile time. To combat this I broke down literal strings into 1k pieces each resulting in their own `WriteLiteral`/`WriteLiteralTo` calls. - Added tests to validate large string rendering. #614
- Loading branch information
1 parent
37eca62
commit 4db32ec
Showing
10 changed files
with
287 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/StringLiterals.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#pragma checksum "StringLiterals.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "69e97ad2cecc829111c1a2ed6b391c9ff7b781ca" | ||
namespace TestOutput | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public class StringLiterals | ||
{ | ||
#line hidden | ||
public StringLiterals() | ||
{ | ||
} | ||
|
||
#pragma warning disable 1998 | ||
public override async Task ExecuteAsync() | ||
{ | ||
Instrumentation.BeginContext(0, 1005, true); | ||
WriteLiteral(@"<p>This is line 1</p> | ||
<p>This is line 2</p> | ||
<p>This is line 3</p> | ||
<p>This is line 4</p> | ||
<p>This is line 5</p> | ||
<p>This is line 6</p> | ||
<p>This is line 7</p> | ||
<p>This is line 8</p> | ||
<p>This is line 9</p> | ||
<p>This is line 10</p> | ||
<p>This is line 11</p> | ||
<p>This is line 12</p> | ||
<p>This is line 13</p> | ||
<p>This is line 14</p> | ||
<p>This is line 15</p> | ||
<p>This is line 16</p> | ||
<p>This is line 17</p> | ||
<p>This is line 18</p> | ||
<p>This is line 19</p> | ||
<p>This is line 20</p> | ||
<p>This is line 21</p> | ||
<p>T"); | ||
WriteLiteral(@"his is line 22</p> | ||
<p>This is line 23</p> | ||
<p>This is line 24</p> | ||
<p>This is line 25</p> | ||
<p>This is line 26</p> | ||
<p>This is line 27</p> | ||
<p>This is line 28</p> | ||
<p>This is line 29</p> | ||
<p>This is line 30</p> | ||
<p>This is line 31</p> | ||
<p>This is line 32</p> | ||
<p>This is line 33</p> | ||
<p>This is line 34</p> | ||
<p>This is line 35</p> | ||
<p>This is line 36</p> | ||
<p>This is line 37</p> | ||
<p>This is line 38</p> | ||
<p>This is line 39</p> | ||
<p>This is line 40</p> | ||
<p>This is line 41</p> | ||
<p>This is line 42</p><"); | ||
WriteLiteral("br>\r\n\r\n"); | ||
Instrumentation.EndContext(); | ||
DefineSection("WriteLiteralsToInHere", async(__razor_template_writer) => { | ||
Instrumentation.BeginContext(1037, 1463, true); | ||
WriteLiteralTo(__razor_template_writer, @" | ||
<p>This is line 1 nested</p> | ||
<p>This is line 2 nested</p> | ||
<p>This is line 3 nested</p> | ||
<p>This is line 4 nested</p> | ||
<p>This is line 5 nested</p> | ||
<p>This is line 6 nested</p> | ||
<p>This is line 7 nested</p> | ||
<p>This is line 8 nested</p> | ||
<p>This is line 9 nested</p> | ||
<p>This is line 10 nested</p> | ||
<p>This is line 11 nested</p> | ||
<p>This is line 12 nested</p> | ||
<p>This is line 13 nested</p> | ||
<p>This is line 14 nested</p> | ||
<p>This is l"); | ||
WriteLiteralTo(__razor_template_writer, @"ine 15 nested</p> | ||
<p>This is line 16 nested</p> | ||
<p>This is line 17 nested</p> | ||
<p>This is line 18 nested</p> | ||
<p>This is line 19 nested</p> | ||
<p>This is line 20 nested</p> | ||
<p>This is line 21 nested</p> | ||
<p>This is line 22 nested</p> | ||
<p>This is line 23 nested</p> | ||
<p>This is line 24 nested</p> | ||
<p>This is line 25 nested</p> | ||
<p>This is line 26 nested</p> | ||
<p>This is line 27 nested</p> | ||
<p>This is line 28 nested</p> | ||
<p>This is line 29 ne"); | ||
WriteLiteralTo(__razor_template_writer, @"sted</p> | ||
<p>This is line 30 nested</p> | ||
<p>This is line 31 nested</p> | ||
<p>This is line 32 nested</p> | ||
<p>This is line 33 nested</p> | ||
<p>This is line 34 nested</p> | ||
<p>This is line 35 nested</p> | ||
<p>This is line 36 nested</p> | ||
<p>This is line 37 nested</p> | ||
<p>This is line 38 nested</p> | ||
<p>This is line 39 nested</p> | ||
<p>This is line 40 nested</p> | ||
<p>This is line 41 nested</p> | ||
<p>This is line 42 nested</p> | ||
"); | ||
Instrumentation.EndContext(); | ||
} | ||
); | ||
Instrumentation.BeginContext(2503, 499, true); | ||
WriteLiteral(@"<p>This is line 1</p> | ||
<p>This is line 2</p> | ||
<p>This is line 3</p> | ||
<p>This is line 4</p> | ||
<p>This is line 5</p> | ||
<p>This is line 6</p> | ||
<p>This is line 7</p> | ||
<p>This is line 8</p> | ||
<p>This is line 9</p> | ||
<p>This is line 10</p> | ||
<p>This is line 11</p> | ||
<p>This is line 12</p> | ||
<p>This is line 13</p> | ||
<p>This is line 14</p> | ||
<p>This is line 15</p> | ||
<p>This is line 16</p> | ||
<p>This is line 17</p> | ||
<p>This is line 18</p> | ||
<p>This is line 19</p> | ||
<p>This is line 20</p> | ||
<p>This is line 21</p> | ||
<br>"); | ||
Instrumentation.EndContext(); | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.