Commit Graph

535 Commits

Author SHA1 Message Date
N. Taylor Mullen 3968eded19 Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:21:25 -08:00
N. Taylor Mullen 3542ec3167 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:21:05 -08:00
Doug Bunting 37850b5d85 Add `TagHelperOutput.GetChildContentAsync()` overloads including an `HtmlEncoder`
- #643 part 1
- change is viral and requires an update to `RazorPage.StartTagHelperWritingScope()`
  - memoize `GetChildContentAsync()` per-encoder
  - update generation tests to match and to test new behaviour
- note `HtmlEncoder`s used elsewhere e.g. in other `RazorPage` instances are unaffected

Add `NullHtmlEncoder`

Nits:
- generally clean up affected doc comments and make them more consistent
- remove unused `using`s in files I had open
2016-01-17 22:34:19 -08:00
Ryan Nowak e68c55ab41 Rewrite of tokenizers 2016-01-15 15:58:27 -08:00
N. Taylor Mullen 1ce9180a3e Prevent unneeded allocations of `Block` children enumerators.
#635
2016-01-15 15:47:35 -08:00
Ryan Nowak 315d79ff2b Make the CodeWriter more efficient 2016-01-15 11:04:32 -08:00
Ryan Nowak 08fef95969 Remove a String.Split 2016-01-15 10:38:08 -08:00
Ryan Nowak 95ea4cc06f Optimize allocations of List<ISymbol> and related 2016-01-14 17:19:25 -08:00
Ryan Nowak ffdf5d2827 Remove allocations from lookahead
This makes lookahead allocation-free, saving about 15MB in our current
benchmark.
2016-01-14 17:19:13 -08:00
N. Taylor Mullen 7a0a9c6caa Remove boxing of symbol types.
- The Equals operators were boxing the symbol types like crazy, added an abstract `SymbolTypeEquals` to avoid this.

#635
2016-01-14 17:18:07 -08:00
Nate McMaster b760156e66 Updating build script 2016-01-14 16:41:14 -08:00
Ryan Nowak 6a4a9544a1 Eliminate extra List<RazorError> copies
Changing to IReadOnlyList since we always want to support indexing.
Replacing ToArray() with non-linq when needed, and with a static
EmptyArray when not needed.

Eliminates 50mb of list copies.
2016-01-14 14:54:47 -08:00
Pranav K 9c6e5f714a Updating to use Dotnet-Cli build 2016-01-12 14:53:10 -08:00
Pranav K 1da673e0e2 Updating NuGetPackageVerifier.json 2016-01-12 11:03:59 -08:00
Pranav K b4d631e2f6 Removing ITypeInfo and related types 2016-01-11 17:45:18 -08:00
Pranav K c05551e167 Removing Microsoft.AspNet.Razor.Runtime.Precompilation 2016-01-11 16:33:22 -08:00
N. Taylor Mullen 605dceea02 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 1024 length pieces each resulting in their own `WriteLiteral`/`WriteLiteralTo` calls. The 1024 number corresponds directly with MVCs response string buffer.
- Added tests to validate large string rendering.

#614
2016-01-06 16:21:32 -08:00
N. Taylor Mullen 33d32cecd9 Remove unused parameter from `TagHelperDesignTimeDescriptorFactory`.
#629
2016-01-05 12:05:41 -08:00
Doug Bunting fe5e1b8c71 Make Razor codegen use invariant culture
- #557
- use `int.ToString(CultureInfo.InvariantCulture)` consistently in `CSharpCodeWriter` / `CSharpCodeVisitor`
- correct `string` operations to use explicit `StringComparison.Ordinal`
- improve `RazorEditorParser` doc comments

nits:
- remove one-off use of `CurrentUICulture` in `LineMapping` debug code (`ToString()` implementation)
- clean a bit of #YOLO wrapping and long lines
2016-01-05 11:52:02 -08:00
Pranav K 37eca627dd Rename TagHelperContent.Append(IHtmlContent` overload to be `TagHelperContent.AppendHtml(IHtmlContent)`
Fixes #634
2015-12-31 11:26:21 -08:00
Pranav K e1aa888165 Allow optional quotes around tag helper directives
Fixes #636
2015-12-29 12:32:23 -08:00
Pranav K 77b74b0c96 Modify TryGetAttributes to return a IReadOnlyList 2015-12-28 13:12:39 -08:00
N. Taylor Mullen dbe4ce06f2 Cache XML file information when creating design time based `TagHelperDescriptor`s.
- Prior to this change we'd hit the disk every time we'd create a `TagHelperDesignTimeDescriptor` to locate an assemblies XML files.
- Did not want to tie the XML cache to a static member in-case a user updates their XML information between parses. Therefore, changed `TagHelperDescriptorFactory` and `TagHelperDesignTimeDescriptorFactory` to no longer be static.
- Put the same `TagHeleprDescriptorFactory` extensibility point as we had for its counterpart `TagHelperTypeResolver` to stay consistent. This involved making `CreateDescriptors` virtual and allowing it to be provided in the `TagHelperDescriptorResolver` constructor.

#630
2015-12-17 11:12:19 -08:00
N. Taylor Mullen 392871beb6 Change missing section end brace error to work at EOF.
- Updated existing tests and added a new case to understand `@section {....` scenarios.
- Instead of trying to guess 1 character prior to EOF decided to log error on opening brace since we know its position. Updated error to account for change in location.

#625
2015-12-11 15:10:53 -08:00
Pranav K 5fecd5bd1e Merge branch 'release' into dev 2015-12-11 12:22:59 -08:00
Pranav K 51920a0af2 Updating to release NuGet.config. 2015-12-11 12:22:57 -08:00
Doug Bunting b95cf5fb7c Add dependency to fix build break
- Common sources needs more
2015-12-11 08:46:44 -08:00
Pranav K c7a6c099ed Removing more unused usings 2015-12-08 09:54:32 -08:00
Pranav K 1e997fec7e * Cleaning up usage of CodeAnalysis.
* Fixing System.Reflection version.
2015-12-07 19:50:10 -08:00
Pranav K 66c9a21848 Reacting to Microsoft.AspNet.Html namespace renames 2015-12-02 10:17:04 -08:00
Pranav K 65e63c893b Enable CoreCLR tests on Travis 2015-12-01 10:34:49 -08:00
Pranav K 2a301691db Updating tests to use moq.netcore 2015-11-23 12:15:26 -08:00
N. Taylor Mullen 31a68a0705 Optimize `TagHelperAttributeList` allocations.
- Today `TagHelperAttributeList` and corresponding infrastructure copy themselves too frequently. I've reduced the copying since we own `TagHelperExecutionContext`.
- Removed usage of linq inside of `TagHelperAttributeList` to reduce allocations.

#599
2015-11-20 16:06:47 -08:00
N. Taylor Mullen 43aabcb2d6 Order `TagHelperExecutionContext.TagHelpers` without `.OrderBy`.
- By using linq we created several `OrderedEnumerable` allocations.

#601
2015-11-20 11:13:55 -08:00
N. Taylor Mullen 6b43ebc88b Update code generation tests to account for new `TagHelperOutput`.
- Add `TagHelperOutput` unit tests.

#358
2015-11-19 16:32:08 -08:00
N. Taylor Mullen e8327eeec7 Lazily initialize `TagHelperOutput`s `Content` properties.
- Added backing fields to each of the content properties and added null propagation checks throughout the class.

#358
2015-11-19 16:32:06 -08:00
N. Taylor Mullen bdf869c3d5 Make `TagHelperOutput` an `IHtmlContent`.
- This allows users to write `TagHelperOutput` directly to an `IHtmlContent` accepting `TextWriter`.
- This also enables us to inspect backing fields for all of the various contents to lazily initialize them.

#358
2015-11-19 16:32:03 -08:00
Pranav K 36c744ff29 Use the new line character to check if the CodeWriter buffer ends in a line feed.
Fixes #577
2015-11-19 15:05:31 -08:00
Ryan Nowak 42acfe43ad Fix aspnet/Mvc#3196 Razor Compilation Allocations
This change significantly reduces the amount of string and List<ISymbol>
allocations that occur during compilation by changing the way
LiteralChunks are combined.

This is a low impact fix that addresses the performance issue, the design
issues that caused it still exist.

The problem here lies in what Razor fundamentally does - it parses HTML/C#
into tokens, and then combines them back into 'chunks' a representation
friendly to code generation. When presenting with a large block of static
HTML, Razor parses it into individual HTML tokens, and then tries to join
them in back into a single chunk for rendering. Due to details of Razor's
representation of chunks/tokens, the process of combining literals is too
expensive.

Mainly, what's done here is to not try to combine instances of
LiteralChunk. The process of merging them is too expensive and requires
lots of interm List<ISymbol> and string allocations.

Instead we produce a new 'chunk' ParentLiteralChunk, which doesn't do so
much up-front computing. Various pieces of the code that deal with
LiteralChunk need to be updated to deal with ParentLiteralChunk also,
which is the bulk of the changes here.

Note that we still have the potential for LOH allocations to occur during
codegen, but it's likely to occur O(1) for each large block of HTML
instead of O(N) as it did in the old code.
2015-11-18 12:51:11 -08:00
Ryan Nowak 5ce8740f70 Simplify ChunkTreeBuilder 2015-11-18 09:43:11 -08:00
Doug Bunting 6ff10c4d6c Small .travis.yml update: Consolidate `brew` commands under a single `if` 2015-11-17 14:56:16 -08:00
Doug Bunting e4084f4ff4 Execute `dnu restore` with .NET Core and use Mono 4.0.5
- upgrade Linux to Trusty (Ubuntu 14.04) distribution, where .NET Core is supported
- Mono beta is now 4.2.1 which doesn't work with `nuget.exe`
  - see also aspnet/External#48

Note: cannot use `KOREBUILD_TEST_DNXCORE=true` due to #577
2015-11-17 09:19:47 -08:00
Ryan Nowak f6c7295f41 React to removal of BufferedHtmlContent 2015-11-16 09:36:35 -08:00
N. Taylor Mullen 53dc4d73a4 Remove System beta tag in project.json for coreclr packages. 2015-11-12 12:23:22 -08:00
Pavel Krymets 7b248a7789 Make Compilation Abstractions naming consistent with Platform Abstractions 2015-11-06 16:18:45 -08:00
N. Taylor Mullen 0c95315500 Update tests to not require quotes for TH directives.
- Updated .cshtml files to not provide quotes for the various `TagHelper` directives.
- Updated `TagHelper` directive parsing tests. This also involved removing several tests that expected errors which no longer occur since we don't have to ensure quotes are balanced.
- Updated line mappings which significantly changed due to us no longer generating line pragmas at design time for `TagHelper` directives.

#561
2015-11-06 12:19:40 -08:00
N. Taylor Mullen 013f3a27af Remove quote requirement for `TagHelper` directives.
- `@addTagHelper`, `@removeTagHelper` and `@tagHelperPrefix` values are all written without quotes now.
- Updated the `ChunkGenerator`s to be in-line with other `ChunkGenerator`s in the system now that they don't have vastly different values than what their corresponding `Span`s have.
- Split `AddOrRemoveTagHelperChunkGenerator` into two smaller `ChunkGenerator`s to stay consistent with other generators.
- Removed error cases introduced by having quotes around directives.
- Updated code generation logic to not generate line pragmas (they should never have been generated to start with) and more specifically only map to the inner string that's generated. Without this change directive mappings would be offeset by a generated quote.

#561
2015-11-06 12:17:30 -08:00
N. Taylor Mullen 02d6b00d8f Generate `async` lambda for template attributes.
- Template attributes should be of type `Func<TextWriter, Task>`. We weren't generating an `async` lambda for attributes prior to this change resulting in a compilation failure when used at runtime and the inability to `@await` code (unless a user returns some sort of `Task`).
- Updated code generation files to reflect the new code generation behavior.

#594
2015-11-04 16:04:29 -08:00
Pavel Krymets 024c673bfa Rename Microsoft.Dnx.Compilation.Abstractions to Microsoft.Extensions.Compilation.Abstractions 2015-11-03 12:56:26 -08:00
Cesar Blum Silveira b329650a33 Merge branch 'release' into dev 2015-11-02 15:10:15 -08:00