Commit Graph

572 Commits

Author SHA1 Message Date
Pranav K e822f5f12d
Create a Blazor WebAssembly SDK (#24044) 2020-07-20 13:25:49 -07:00
Doug Bunting b1921f38bc
Merge remote-tracking branch 'origin/release/5.0-preview8' into 'master' 2020-07-17 15:03:15 -07:00
Doug Bunting 5266918ed2
Use Roslyn to create ref/ assemblies (#23403)
* Remove all ref/ projects

* Remove GenAPI infrastructure

* Remove notion of a reference assembly project
  - remove `$(IsReferenceAssemblyProject)`, `$(ReferenceReferenceAssemblies)` and `$(ReferenceImplementationAssemblies)`
    - remove unnecessary `$(NoWarn)` settings

nits:
- remove a few misleading comments
- wrap some long lines

* Move .0 package version workaround into Versions.props
  - touch up SharedFramework.External.props

* Expose `%(LatestPackageReference.RTMVersion)` metadata
  - automate use of properties in the `@(LatestPackageReference)` item group to make this maintainable
    - add a couple of special cases at the bottom of eng/Dependencies.props
    - add one more `$(...PackageVersion)` property to avoid yet-another special case

* Enable Roslyn reference assemblies
  - exclude ref/ assembly from packages other than targeting pack
  - update Microsoft.AspNetCore.App.Ref.csproj
    - `%(IsReferenceAssembly)` and `%(ReferenceGrouping)` metadata no longer relevant
    - only ref/ assemblies are in `@(ReferencePathWithRefAssemblies)` item group

nits:
  - remove now-unnecessary workaround
    - issues with TFM transition are behind us
  - clean up Microsoft.AspNetCore.App.Runtime.csproj slightly
    - use `GeneratePathProperty="true"`
        - reorder item / property settings for meta-expansion
    - correct spelling errors and phrasing in comments

* Update documentation to reflect recent changes
  - remove CrossRepoBreakingChanges.md; was tied to old TeamCity infrastructure
    - also much less relevant given repo merges
  - adjust details and examples in ReferenceResolution.md
    - reflect repo merges, Dependencies.props changes, and current Maestro++ channels
    - add a few more details e.g. specific files where Version.Details.xml versions are used

* !fixup! Remove another irrelevant doc file

* !fixup! Address PR review suggestions
  - convert a couple of warnings to errors
  - use consistent casing for Microsoft.NETCore.App.Runtime.* packages
  - reduce `%(LatestPackageReference.Version)` metadata special cases
  - add and improve comments e.g.
    - improve comments about `$(*V0PackageVersion)` properties
    - improve placement of comments about item removal in ResolveReferences.targets
    - confirmed `$(*V0PackageVersion)` property list is complete

nits:
- fix solution example in ReferenceResolution.md
- remove item group definition for `@(LatestPackageReference)`
- remove `%(LatestPackageReference.VersionName)` metadata after use; large item group
    - similarly, remove `%(LatestPackageReference.RTMVersion)` when not needed; just complicates `Condition`s

When I squash, I must remember this fixes
- #14801
- dotnet/aspnetcore-internal#2693

* Actually use `%(LatestPackageReference.RTMVersion)` metadata
  - gather RTM package references in a new project
    - a (very) separate project to work around package conflict resolution
    - empty `Test` target works around Arcade's testing approach
  - new target in ResolveReferences.targets updates relevant assembly paths to use the RTM packages
    - done as soon as possible after `ResolvePackageAssets` determines the paths
    - done for all compilation inputs, not just ref/ assemblies
2020-07-17 13:35:17 -07:00
Stephen Halter 30c33aad11
Quarantine flaky tests (#23995) 2020-07-16 11:47:47 -07:00
Eric Erhardt 427bfc8d6b
Default new runtime feature switches (#23932) (#23987)
* Default new runtime feature switches

These new feature switches have been added to the runtime to make applications smaller. Setting reasonable defaults to Blazor wasm projects.

Fix #23716

* PR feedback
2020-07-15 21:48:12 -07:00
Eric Erhardt 7b42cf1275
Default new runtime feature switches (#23932)
* Default new runtime feature switches

These new feature switches have been added to the runtime to make applications smaller. Setting reasonable defaults to Blazor wasm projects.

Fix #23716

* PR feedback
2020-07-16 01:19:07 +00:00
Brennan f0bb1315cc
Quarantine Publish_WithoutLinkerAndCompression_UpdatesFilesWhenSourcesChange (#23900) 2020-07-13 18:18:25 -07:00
Pranav K 69ec50bfd8
Increase test timeouts (#23868) 2020-07-13 21:58:54 +00:00
Steve Sanderson 90b697f92e
Razor compiler emit CSS scope attributes (#23703) 2020-07-13 17:27:27 +01:00
Brennan dbfdc5c87b
Update StaticWebAssetsIntegrationTest.cs (#23859) 2020-07-10 15:34:26 -07:00
Safia Abdalla bbc116254a
Add framework support for lazy-loading assemblies on route change (#23290)
* Add framework support for lazy-loading assemblies on route change
* Configure lazy-loaded assemblies in WebAssemblyLazyLoadDefinition
* Move tests to WebAssembly-only scenarios
* Refactor RouteTableFactory and add WebAssemblyDynamicResourceLoader
* Address feedback from peer review
* Rename 'dynamicAssembly' to 'lazyAssembly' and address peer review
* Add sample with loading state
* Update Router API and assembly loading tests
* Support and test cancellation and pre-rendering
* Apply suggestions from code review
Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
* Spurce up API and add tests for pre-rendering scenario
* Use CT instead of CTS in NavigationContext
* Address feedback from peer review
* Remove extra test file and update Router
Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
2020-07-08 18:16:47 -07:00
Kevin Pilch 3117f43c33
Migrate to single sln file + slnf files (#23581) 2020-07-08 15:27:22 -07:00
Kevin Pilch 1da13e6501
Enable FxCop Analyzers for the repo (#23709)
All rules are currently disabled, except for one that I enabled for
src/Http via a new ".editorconfig" file I added there.

Other changes:

* Allow editorconfigs in MVC and Razor to flow to the root
* Consolidate a few editorconfig settings
* Tweak Ruleset config in Azure/AzureAD where it clashed.

Addresses the beginning of #9620, but it's a fair chunk of work to
enable most rules through the whole repo. That can be done directory by
directory and rule by rule by dropping .editorconfig files though.
2020-07-08 15:26:22 -07:00
Steve Sanderson 1bccebd22a
Fix razor whitespace removal in methods (#23699) 2020-07-08 12:43:09 +01:00
Steve Sanderson c5ba43f011
CSS isolation rewriter tool (#23657) 2020-07-08 12:42:22 +01:00
Doug Bunting 16be480616
Quarantine tests and bump Helix timeouts (#23762)
- see #23756 and #23757 for more info on quarantined tests
- see #23760 for more info on Helix timeouts
2020-07-07 19:56:30 -07:00
Eric Erhardt cc3c1d0e74
Remove unnecessary entries in LinkerWorkaround for WASM. (#23747)
* The underlying Json issue is fixed.
* The X509 issue is not an issue when TrimMode is set to link (which is it now by default).

Contributes to #23262
2020-07-08 01:00:21 +00:00
msftbot[bot] a738d1ccfb
Merge pull request #23717 from dotnet-maestro-bot/merge/release/5.0-preview7-to-master
[automated] Merge branch 'release/5.0-preview7' => 'master'
2020-07-06 23:41:07 +00:00
Tanay Parikh 1c2a0f4fe6
Add Razor TagHelper Parsing Benchmarks (#23627)
* Add Razor TagHelper Parsing Benchmarks

Benchmarks:
|                                  Method |        Mean |     Error |    StdDev |     Op/s | Allocated |
|---------------------------------------- |------------:|----------:|----------:|---------:|----------:|
|      'TagHelper Design Time Processing' | 2,331.51 us | 28.916 us | 27.048 us |    428.9 | 985.33 KB |
| 'TagHelper Component Directive Parsing' |    90.46 us |  0.472 us |  0.394 us | 11,055.1 |   3.01 KB |

Notes / Attributions:
- `BlazorServerTagHelpers` is just a demo file concatonated from the basic `BlazorServer` files
- `taghelpers.json` was updated from: 73c96f1c00/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json
- `ReadTagHelpers` was copied over from fef50ba623/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs (L83-L93)

Fixes: https://github.com/dotnet/aspnetcore/issues/23454
2020-07-06 16:32:12 -07:00
Ajay Bhargav B 7412976b4c
Update Roslyn package versions (#23630)
* Update Roslyn package versions

* Fixes

* Fix analyzer warnings

* Fix root cause for analyzer warnings

* Fixed RuntimeCompilation test

* Add back nowarns
2020-07-06 14:35:10 -07:00
N. Taylor Mullen 17b01ae667 Fix PoliCheck issues
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1151846
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1151847
2020-07-06 13:02:45 -07:00
Pranav K 80de1e7588
Quarantine test (#23636) 2020-07-06 15:49:33 +00:00
Pranav K de034feb98
Merge branch 'master' into merge/release/5.0-preview7-to-master 2020-07-05 20:54:56 -07:00
Pranav K 499a3bcdc1
Add support for gzip compression during build and publish (#23611)
* Add support for gzip compression during build and publish

3.2 shipped with gzip compression during build and publish. During the port to 5.0, the build and publish
pipeline was different and ended up only during brotli compression during publish. However, during build
the app size is now up to 20MB. Statically compressing runtime assets during build reduces the payload size
to about 8.5 MB. This should help with faster initial boot ups and perception.

* Quarantine test

* More quarantine
2020-07-03 17:20:17 -07:00
Pranav K 9a4e6cf97c
Merge remote-tracking branch 'origin/release/5.0-preview7' 2020-07-02 11:42:14 -07:00
Pranav K dc4670e8d5
Merge pull request #23427 from dotnet-maestro-bot/merge/release/5.0-preview7-to-master
[automated] Merge branch 'release/5.0-preview7' => 'master'
2020-07-01 07:27:53 -07:00
Pranav K 8768cab874
Use linker extensibility to enable better trimming (#23512)
* Use linker extensibility to enable better trimming

* Configure TrimmerDefaults=link if unspecified
* Allow Microsoft.AspNetCore.* and Microsoft.Extensions.* packages to be trimmed.

* Make producing the trimmer root descriptor more incremental
2020-06-30 20:39:58 -07:00
Pranav K 71e388eab7
Unquaratine blazor template tests (#23521)
* Ensure BlazorWebAssembly.js is present

* Unquaratine blazor template tests

* The failure issue https://github.com/dotnet/aspnetcore/issues/20479 was resolved, but the assembly level quarantine was
missed being removed.
* Use shorter project file names to avoid long path issues.
* Update blazorwasm template tests to react to net5 updates

* Update src/ProjectTemplates/Shared/ProjectFactoryFixture.cs
2020-06-30 21:58:54 +00:00
Ajay Bhargav B 7f4b846e9f
Made the encodings of .razor and .cshtml files in the repo consistent (#23502)
* Added UTF8 BOMs to .razor and .cshtml files

* Fixes and unquarantined BOM tests

* Update .editorconfig
2020-06-30 12:03:01 -07:00
Pranav K 3fe6b07412
Ensure BlazorWebAssembly.js is present (#23518) 2020-06-30 11:38:20 -07:00
Steve Sanderson eb76931578
Strip insignificant whitespace at compile time (#23385)
* Define @preservewhitespace directive attribute

* Have ComponentWhitespacePass respect preservewhitespace option

* Tests for overriding the preservewhitespace option (and fix implementation)

* Begin adding test infrastucture for ComponentWhitespacePass

* Remove leading/trailing whitespace from markup elements recursively

* Update baselines

* Add test showing we don't remove whitespace between sibling elements

* Remove whitespace before/after C# code statements (not expressions)

* Update baselines

* Slight improvements to test

* Remove leading/trailing whitespace inside component child content

* Update baselines

* Fix Razor tests

* Fix MVC test

* Better fix for MVC test

* CR: Make ComponentPreserveWhitespaceDirective conditional on langversion >= 5.0
2020-06-30 07:49:28 -07:00
Pranav K 4a93863b8d
Fix the blazorwasm benchmark app (#23498)
Specifying the RID and PublishDir when publishing the driver app causes all sorts of
build issues. This change moves specifying the RID in to the driver app and ensures PublishDir
does not flow to the referenced RazorSDK project.

* Fix docker build
* Update readme typos
2020-06-30 06:31:41 -07:00
Pranav K b93db41b5e
Merge branch 'master' into merge/release/5.0-preview7-to-master 2020-06-29 13:29:53 -07:00
Chris Ross e906c2067b
Quarantine Publish_HostedApp_WithSatelliteAssemblies (#23479) 2020-06-29 19:34:09 +00:00
Pranav K 04ecd5539f
Merge pull request #23365 from dotnet-maestro-bot/merge/release/5.0-preview7-to-master
[automated] Merge branch 'release/5.0-preview7' => 'master'
2020-06-26 18:36:03 -07:00
Pranav K 23a3e845e5
Add RazorLangVersion 5.0 (#23408)
* Add RazorLangVersion 5.0

* Fixup more tests. Add a test for 3.1
2020-06-26 17:49:29 -07:00
Brennan e4158e8a59
Quarantine Publish_HostedApp_VisualStudio_WithSatelliteAssemblies and Publish_UpdatesFilesWhenSourcesChange (#23398)
* Update WasmPublishIntegrationTest.cs

* Update WasmCompressionTests.cs
2020-06-26 22:42:48 +00:00
Pranav K 65d9429a7d
Add workaround for https://github.com/mono/linker/issues/1298 (#23368) 2020-06-26 08:54:38 -07:00
Eric Erhardt 4891eadbbc
Remove the file extension in CreateBlazorTrimmerRootDescriptorFile (#23330)
The linker doesn't resolve assemblies correctly if the file extension (.dll) is included in the assembly name in the descriptor xml file.

See also https://github.com/mono/linker/issues/1294
2020-06-26 08:34:03 -07:00
Pranav K a93ff60904
SDK fixes (#23317)
* Fix up Blazor ILLink Descriptor files

1. Add the typegranularity file to TrimmerRootDescriptor.
2. Remove the application assembly descriptor file, since the application assembly is passed in as a RootAssembly already.

* Razor SDK fixups for blazor

* Only include dlls when generating type granular assemblies
* Write server-worker to the obj directory

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2020-06-25 08:52:53 -07:00
Pranav K f6a6e4bd07
Replat blazor on net5 (#23078)
* Replat blazor on net5

* Make all e2e tests pass

* Fixup

* Update js files

* Fixups

* Fixup

* Fixup

* Skip globalization tests

* Undo workarounds

* PR feedback

* Update dependencies from https://github.com/dotnet/runtime build 20200622.6

System.ComponentModel.Annotations , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging , Microsoft.Extensions.Internal.Transport , Microsoft.Extensions.Http , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Configuration.Xml , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry , Microsoft.Win32.SystemEvents , Microsoft.NETCore.App.Internal , Microsoft.NETCore.App.Ref , System.Drawing.Common , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.Channels , System.Windows.Extensions , System.Security.Principal.Windows , System.Security.Permissions , System.Security.Cryptography.Xml , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Net.WebSockets.WebSocketProtocol , System.Reflection.Metadata , System.Runtime.CompilerServices.Unsafe , System.Security.Cryptography.Cng , System.Security.Cryptography.Pkcs
 From Version 5.0.0-preview.7.20321.2 -> To Version 5.0.0-preview.7.20322.6

* Update js file

* Fix version

* Fixup

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2020-06-23 18:19:55 -07:00
Doug Bunting ab7f3f2018
Enable `/warnAsError` (#23072)
* Enable `/warnAsError` in Windows builds
  - already enabled in non-Windows builds because override existed only in build.ps1
* Allow some warnings related to closed issues
  - common `<NoWarn>$(NoWarn);CS1591</NoWarn>` case unchanged
    - /Directory.Build.props ensures that warning remains a warning but doesn't hide it
* !fixup! Root build.sh _does_ disable warnings as errors
  - variable eng/common/tools.sh uses named `warn_as_error`
2020-06-18 15:59:34 -07:00
Doug Bunting c4c6e25a06
Add missing doc files and cleanup nits (#22931)
* nit: Remove useless `$(HasReferenceAssembly)` settings
  - set in /Directory.Build.targets
    - `true` only in `$(IsAspNetCoreApp)` projects
* nit: Remove useless `$(CompileUsingReferenceAssemblies)` settings
  - no current versioning differences between ref/ and src/ assemblies when targeting default TFM
* Add more `$(GenerateDocumentationFile)` settings
  - increases the number of generated doc files, mostly without problems
- !fixup! correct typo in `DebugProxyHost` doc comments
    - was not generating a doc file before
  - remove previous (ineffective) src/Components/Directory.Build.targets setting
  - nit: remove a duplicate `$(GenerateDocumentationFile)` setting
* nit: Remove useless `$(IsPackable)` settings
  - only analyzers and implementation projects are packable by default
    - main use case for explicit setting is projects shipping only in shared framework
  - conditional setting in src/Mvc/Directory.Build.props just subset logic in /Directory.Build.targets
* nit: Remove useless `$(IsProjectReferenceProvider)` settings
  - only implementation projects are providers by default
* nit: Remove useless `$(IsTestAssetProject)` settings
  - set in src/Mvc/test/WebSites/Directory.Build.props
* !fixup! Looks like `InProcessNewShimWebSite` must compile w/o ref/ assemblies
  - restore `$(CompileUsingReferenceAssemblies)` in this one project
2020-06-17 13:04:45 -07:00
N. Taylor Mullen 538c462c05 Enable Helix tests for Microsoft.AspNetCore.Mvc.Razor.Extensions.* projects.
- Enabled Helix for:
    - `Microsoft.AspNetCore.Mvc.Razor.Extensions.Test`
    - `Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test`
    - `Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Test`
- These tests depended on our MVC shim project's deps.json's to exist in the test bin directory during publish. Therefore added an additional target copy over those assets at publish time.
- There were some tests that were relying on source positions from a string to match a runtime generated source position. In Helix dll's are built on Windows (string's get compiled with \r\n) and then deployed to potentially non-Windows boxes resulting in mismatches of expectations. To address this I changed the test that had this dependency to dynamically generate the input string.
- Our common language test project used to rely on test files being on disk. At some point in the past those test files started being embedded in the assembly but we maintained directory checking logic to ensure various directories existed on disk (no longe required). Changed the logic to not enforce directories to be on disk (they aren't in Helix) and instead only rely on the embedded TestFiles.

dotnet/aspnetcore#22100
2020-06-17 11:49:49 -07:00
Todd Grunke 56374ab393 use var where appropriate 2020-06-15 13:15:38 -07:00
Todd Grunke 2c594199c3 Fix a bug in DefaultRazorSourceLineCollection.GetLineStarts 2020-06-12 17:56:19 -07:00
Todd Grunke a1dd898994 Get rid of LineTrackingStringBuffer class and instead use the line information provided by RazorSourceDocument.
This additionally gets rid of an extra whole buffer allocation in the ParserContext. The most complex bit of the change is around avoiding TextLineCollection.GetLocation.

Overall, I'm seeing a pretty big win here, about 35% less time spent in RazorSyntaxTree.Parse for the typing scenario I was doing in a very large file.
2020-06-12 17:22:24 -07:00
Todd Grunke 073cd0aa40
Merge pull request #22877 from dotnet/dev/toddgrun/MorePerfOptimizations
Dev/toddgrun/more perf optimizations
2020-06-12 13:25:31 -07:00
Todd Grunke 43a628e9fb Small memory allocation optimization in DefaultRazorTagHelperBinderPhase.TrySplitNamespaceAndType
This method allocated multiple strings on every invocation when they were rarely needed. With this change, I see a reduction in memory allocated during RazorProjectEngine.ProcessDesignTime of 1.4%.
2020-06-12 12:04:47 -07:00
Javier Calvarro Nelson 53696e4228
Quarantine static web assets tests so we can capture more data for diagnostics (#22876) 2020-06-12 10:14:22 -07:00
Todd Grunke 9cf611b9e2 Revert change to EndLocation as it was incorrectly changed. 2020-06-12 08:28:32 -07:00
Todd Grunke 904fd19605 A couple more perf optimizations focused around memory allocations.
This is the last of the easy wins that I could find for typing in large razor files (minus the logged bug to move the divergence checker code off the UI thread). In the profile for the large document editing, these changes reduce allocated memory during RazorSyntaxTree.Parse by about 25%. CPU wise, the win isn't quite as dramatic, only a couple percent improvement under RazorSyntaxTree.Parse.
2020-06-11 18:11:29 -07:00
Pranav K 0a42cca945
Razor SDK build ordering issues (#22684)
* Razor SDK build ordering issues

* Build the SDK completely regardless of the MSBuild runtime type
* Split SDK integration tests into a separate project. Clean up project file

* Add project to sln

* Update Microsoft.NET.Sdk.Razor.csproj

* Fixup tests

* Avoid rebuilding dependencies if they appear up to date. Fixup tests

* Fixup

* Update CSharp.Common.props

* Cleanup the build
2020-06-11 21:16:05 +00:00
Todd Grunke 73f04eecac
Add mechanism where IR token generation can defer allocation of it's … (#22792)
* Add mechanism where IR token generation can defer allocation of it's content.

It turns out that many IR tokens access their content, and thus allocating it is unnecessary. In particular, with this change against a large file, I've seen allocations under SyntaxNodeExtensions.GetContent reduced by about 33%. Performance wise, I've seen the number of CPU samples in the profile under GetContent reduce by about 40% (in my sample I typed 26 characters and there was about 600 ms less spent in GetContent)

* ContentGetter => ContentFactory

* Make tests happy with the switch from IntermediateToken to IntermediateTokenWithDeferreedContentAllocation

* IntermediateTokenWithDeferredContentAllocation => LazyIntermediateToken
2020-06-11 18:20:41 +00:00
Todd Grunke 837c639041 Expand the SyntaxTokenCache to contain more than just whitespace tokens. 2020-06-08 15:37:35 -07:00
Todd Grunke a5d433103c Stop boxing to compare the SyntaxKind enum during tokenization
This accounts for a significant portion of razor's allocations during parsing.
2020-06-08 10:45:11 -07:00
John Luo 836001cf96
Set PublishWindowsPdb for Razor tooling packages (#22605) 2020-06-05 23:38:17 +00:00
dotnet-maestro[bot] cdb87ee776
[master] Update dependencies from dotnet/runtime (#22571)
* Update dependencies from https://github.com/dotnet/runtime build 20200605.1

System.ComponentModel.Annotations , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Extensions.Logging , Microsoft.Extensions.Internal.Transport , Microsoft.Extensions.Http , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.Hosting , Microsoft.Extensions.Configuration.Json , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.Win32.Registry , Microsoft.Win32.SystemEvents , Microsoft.NETCore.Platforms , Microsoft.NETCore.App.Internal , Microsoft.NETCore.App.Ref , System.Drawing.Common , System.Text.Encodings.Web , System.Text.Json , System.Threading.Channels , System.Windows.Extensions , System.ServiceProcess.ServiceController , System.Security.Principal.Windows , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Net.WebSockets.WebSocketProtocol , System.Reflection.Metadata , System.Runtime.CompilerServices.Unsafe , System.Security.Cryptography.Cng , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions
 From Version 5.0.0-preview.7.20303.11 -> To Version 5.0.0-preview.7.20305.1

* Use the array overload of Task.WhenAny

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ajay Bhargav Baaskaran <ajbaaska@microsoft.com>
2020-06-05 21:22:58 +00:00
Pranav K 1656b4bfcf
Update SDK tests (#22560)
* Add some test for MVC 3.1 \ Blazor 3.1
* Remove tests and testapps for 1.1 \ 2.2
2020-06-05 11:19:17 -07:00
Todd Grunke da52d6b636
Move IsSpacingToken perf optimizations down to base class (#22555)
This gives the HtmlMarkupParser the same non-allocating behavior for it's IsSpacing* method invocations. Profile from following feedback ticket showed ~100ms time spent doing these allocations: https://developercommunity.visualstudio.com/content/problem/1006207/vs-2019-constant-freezing-please-wait-for-an-edito.html?childToView=1065769
2020-06-04 23:56:50 +00:00
Ajay Bhargav B c329dc555a
Quarantined flaky RazorSDK tests (#22553) 2020-06-04 22:24:23 +00:00
Pranav K e89abd13d4
Reduce Razor SDK copy retries (#22448)
* Retry fewer times when building locally
* Fail as usual when building in CI
2020-06-03 16:04:29 -07:00
Pranav K 9eaef28b31
Attempt to capture binlogs when test times out (#22468) 2020-06-03 10:02:03 -07:00
Brennan 381ac51af6
Fix nullable warning in IntegrationTestBase (#22487) 2020-06-03 07:48:35 -07:00
Brennan b5e37866d5
Quarantine flaky tests (#22450) 2020-06-02 13:01:54 -07:00
Ajay Bhargav B d68ff6182e
Add IVT from Razor.Language to LanguageServerClient.Razor assembly (#22474) 2020-06-02 19:21:44 +00:00
John Luo 79d3e3e701
Add migrated projects to Razor.sln (#22378) 2020-06-01 13:17:55 -07:00
Tanay Parikh d117dde356
Minor Documentation Grammar Fix 2020-05-29 17:53:29 -07:00
John Luo a65a466173
Add a transport package for Mvc.Razor.Extensions pdbs (#22299)
* Add a transport package for Mvc.Razor.Extensions pdbs

* Feedback

* Add two more pdbs
2020-05-28 19:45:52 -07:00
John Luo b73662ec4f
Always copy Mvc.Razor.Extensions.dll to razor sdk output (#22327) 2020-05-28 14:36:20 -07:00
John Luo 68fea5b9c2 Remove files that should stay in aspnetcore-tooling
Also address some lingering feedback
2020-05-27 16:05:14 -07:00
John Luo 7b56497d5e Merge branch 'master' of ..\aspnetcore-tooling2\ 2020-05-27 15:14:25 -07:00
John Luo 297c82f7a4 Fix build 2020-05-27 12:23:09 -07:00
Pranav K 58cc148ada Skipping flaky tests (dotnet/aspnetcore-tooling#1926)
* Skipping flaky tests

* Update StaticWebAssetsIntegrationTest.cs\n\nCommit migrated from beba53c682
2020-05-26 22:17:26 -07:00
Pranav K ed132be5fe Update StaticWebAssetsIntegrationTest.cs (dotnet/aspnetcore-tooling#1923)
\n\nCommit migrated from aa8bade12e
2020-05-26 22:17:26 -07:00
John Luo 335364165f Fix race in build 2020-05-26 18:10:34 -07:00
John Luo 50f3a16571 aspnetcore-tooling migration fixups 2020-05-26 12:31:49 -07:00
John Luo c565c2a4f1 Merge branch 'master' of ..\AspNetCore-Tooling\ into johluo/tooling-soncolidation-source-2 2020-05-16 17:50:17 -07:00
Todd Grunke d782a06462 Decrease allocations from using method groups (dotnet/aspnetcore-tooling#1896)
* Previous optimization didn't help as much as intended.

By specifying a method group as the arguments to method like ReadWhile, an allocation was still occurring. Instead, cache the Func as a member in the class and use it instead of the method group.\n\nCommit migrated from 2e6aa150bc
2020-05-13 16:00:34 -07:00
Todd Grunke 016fd1ee9e Improve CSharpLanguageCharacteristics.MapKeyword performance (dotnet/aspnetcore-tooling#1879)
* Improve CSharpLanguageCharacteristics.MapKeyword performance

The razor typing perf test profile I'm looking at has 156 ms of CPU cycles spent in this method, mostly in Enum.ToString()
\n\nCommit migrated from e821a4642e
2020-05-11 12:42:39 -07:00
Todd Grunke a70de6b67b Small perf improvement in TokenizerBackedParser.Accept and ReadWhile. (dotnet/aspnetcore-tooling#1882)
In the razor perf typing test, Accept was showing 27 ms allocating enumerators. Additionally, modified ReadWhile to only allocate if it would return a non-empty collection (and to not use the complexity introduced by using yield enumerators)\n\nCommit migrated from 27a14af36a
2020-05-11 10:28:31 -07:00
Todd Grunke 485924edd2 Improve Annotation and SpanContext performance. (dotnet/aspnetcore-tooling#1881)
The razor perf test shows about 70 ms CPU of WithSpanContext is in allocation. GetAnnotation similarly is showing about 60 ms in allocation (of which this only partly improves)\n\nCommit migrated from a060f129ff
2020-05-11 10:27:40 -07:00
Todd Grunke d1e7d8e466 Improve HtmlTokenizer.AtToken performance. (dotnet/aspnetcore-tooling#1880)
Our razor typing test measured 153 CPU ms in this method. Optimized by fewer calls to CurrentCharacter, not checking '<' twice, and uswing a switch stmt.\n\nCommit migrated from c601c2f11e
2020-05-11 10:26:56 -07:00
dotnet-maestro[bot] f701a188c2 [master] Update dependencies from dotnet/arcade dotnet/runtime (dotnet/aspnetcore-tooling#1873)
* Update dependencies from https://github.com/dotnet/runtime build 20200507.11

- Microsoft.Extensions.Logging: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.Extensions.Configuration.Json: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.NETCore.Platforms: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.NETCore.App.Internal: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- Microsoft.NETCore.App.Ref: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- System.Diagnostics.DiagnosticSource: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- System.Text.Encodings.Web: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11
- System.Reflection.Metadata: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20257.11

* Update dependencies from https://github.com/dotnet/arcade build 20200506.5

- Microsoft.DotNet.Arcade.Sdk: 5.0.0-beta.20228.4 -> 5.0.0-beta.20256.5

* Update SDKs and TFMs

* Try fixing SDK target

* Try removing reference to xunit?

* Try again?

* Revert test tfm

* Remove more xunit references

* Update dependencies from https://github.com/dotnet/runtime build 20200508.3

- Microsoft.Extensions.Logging: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.Extensions.Configuration.Json: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.NETCore.Platforms: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.NETCore.App.Internal: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- Microsoft.NETCore.App.Ref: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- System.Diagnostics.DiagnosticSource: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- System.Text.Encodings.Web: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3
- System.Reflection.Metadata: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20258.3

* Use `dotnet msbuild` in CI builds

* Update dependencies from https://github.com/dotnet/runtime build 20200509.5

- Microsoft.Extensions.Logging: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.Extensions.Configuration.Json: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.NETCore.Platforms: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.NETCore.App.Internal: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- Microsoft.NETCore.App.Ref: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- System.Diagnostics.DiagnosticSource: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- System.Text.Encodings.Web: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5
- System.Reflection.Metadata: 5.0.0-preview.5.20253.7 -> 5.0.0-preview.5.20259.5

* Try undoing `$(EnableFrameworkPathOverride) workaround

* Fix windows builds

* Fix NET.sdk.Razor.Test

* Try fix codecheck

* Skip tests failing with CS1701

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: John Luo <johluo@microsoft.com>
Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com>\n\nCommit migrated from a60b721dbb
2020-05-11 02:32:33 +00:00
Todd Grunke b0d819f1e8 Several changes targeted to improving perf of RazorSyntaxTree.Parse (dotnet/aspnetcore-tooling#1874)
* Several changes targeted to improving perf of RazorSyntaxTree.Parse

1) Modify ParserHelpers.IsNewLine to use a switch instead of Array.IndexOf
2) Modify Tokenizer.CreateToken to take in an array of RazorDiagnostics rather than an IReadOnlyList as that was causing a ToArray call on an empty diagnostics very often (during a SyntaxFactory.Token call)
3) Modify TokenizerBackedParser.Putback to allow an IReadOnlyList as a parameter to not require creation of a reverse enumerator.
4) Cut down allocations in HtmlMarkupParser.GetParserState by:
    a) Using an IReadOnlyList instead of IEnumerable to get rid of the allocations from the .any calls
    b) Don't allocate while reading initial spacing
    c) Inline the IsSpacingToken code so cut down on code executed and need to allocate a separate Func
5) Modify CSharpCodeParser.IsSpacingToken to now be a set of methods instead of a single method that allocates a Func. This is a very high traffic method.
6) Implement a fairly rudimentary Whitespace token cache, as they can be reused. This was based off Roslyn's SyntaxNodeCache, but simplified significantly. It's probably worth investigating whether you should more fully embrance token caching outside of whitespace.

* PR feedback and added one more optimization in LocateOwner that's been bugging me for years. Assuming all chidlren are contained within a nodes span, we can short-circuit the DFS this code was doing significantly cutting time in this method which is important as it's exercised on the main thread during typing.

* missed a space

* StringTextToSnapshot's switch to IsNewLine needed to use start as the index to begin the search, not zero.\n\nCommit migrated from 45411f7526
2020-05-09 06:06:13 -07:00
N. Taylor Mullen ed7338c15a Remove RazorDeveloperTools because they were infrequently used and caused problems.
\n\nCommit migrated from c2d717bc98
2020-05-08 16:52:27 -07:00
Todd Grunke c027fcf8e6 Missed a minor optimization as I wasn't using a parameter for the binary search method. The files I've opened don't actually hit the code path (they always hit the optimization for checking the previous/next/current line)
\n\nCommit migrated from 75f34eec60
2020-05-07 20:44:15 -07:00
Todd Grunke 069b409dd4 Fix perf issue in LineTrackingStringbuffer.ScanLines.
I noticed several hundred ms spent in this method from a customer profile. Primarilly, the method was doing a linear scan of all lines trying to find one that contained the requested position. I changed this to a binary search, but kept/improved the optimization around checking next/previous lines before instigating the search.

Note, there was also a bug where the old code did:

else if (absoluteIndex > _currentLine.Index && _currentLine.Index + 1 < _lines.Count)

but it should have been coparing absoluteIndex with _currentLine.Start
\n\nCommit migrated from 32a0f28708
2020-05-07 17:35:41 -07:00
N. Taylor Mullen 4bdf89bdf9 Fix more policheck failures in MSN.cshtml\n\nCommit migrated from c2507ca208 2020-05-04 13:49:38 -07:00
Javier Calvarro Nelson 7eca4ab2ec [Static web assets] Use prebuilt packages in tests
* Avoids running dotnet restore and dotnet pack during tests which caused test hangs\n\nCommit migrated from 300eeb08d2
2020-05-04 12:19:08 -07:00
Javier Calvarro Nelson 1af2060d53 [Fixes dotnet/aspnetcore-tooling#17233 dotnet/aspnetcore-tooling#18543 dotnet/aspnetcore-tooling#18707 dotnet/aspnetcore-tooling#18561][Static web assets] Improve test reliability (dotnet/aspnetcore-tooling#1844)
* Improves the reliability of the affected tests with retries
* Pack and restore fail/hang in some occasions. The retries minimize
  the chances of these happening.
* For pack, we retry a few times but we ultimately continue as we've
  seen the package gets generated when pack hangs and looks correct.
  If that were not to be the case in the future, the test will fail.\n\nCommit migrated from 0d03b57617
2020-04-28 10:25:49 -07:00
N. Taylor Mullen 986d465c19 Fix PoliCheck failures.
Addresses:
- https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1111066
- https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1111067
- https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1111068
\n\nCommit migrated from 9603451af9
2020-04-27 13:38:52 -07:00
Jan Joneš 1d56c516f8 Implement `EmptyOrWhiteSpaceWriter.Encoding` 2020-04-08 11:59:18 -07:00
Kevin Pilch f34033a415 Add .vsconfig files in root and beside slns 2020-03-31 14:25:44 -07:00
Ryan Brandenburg 36c2448bd3 Serialize project state from VS to project.razor.json (dotnet/aspnetcore-tooling#1711)
Serialize project state to project.razor.json\n\nCommit migrated from fef50ba623
2020-03-31 11:07:08 -07:00
Ryan Brandenburg 0c84b3abd5 Serialize project state from VS to project.razor.json (dotnet/aspnetcore-tooling#1711)
Serialize project state to project.razor.json\n\nCommit migrated from fef50ba623
2020-03-31 11:07:08 -07:00
N. Taylor Mullen 926bbfa14b Update Roslyn tooling versions.
- Moved from 3.4.0 Roslyn to 3.6.0-3.20168.4 for tooling builds.
- As part of this change I found that our package versions were starting to get really confusing for which Roslyn packages were runtime vs. which ones were tooling. Therefore, I rebranded each of the versions to be `Tooling_` or `Runtime_` accordingly. Moved all `VSIX_` => `Tooling_`.
- Roslyn's bits depended on a newer `StreamJsonRpc`, `Microsoft.VisualStudio.Threading` and `Microsoft.VisualStudio.LanguageServer.Client` packages so updated those dependencies to not have version conflicts.
- This new update brought in loads of new analyzers. Went through the warnings and either applied the fix or suppressed.
- This is in preparation for consuming new pieces from latest Roslyn packages.
\n\nCommit migrated from df5261e418
2020-03-24 12:08:32 -07:00
Tanay Parikh 26c5807c98 <text> Tag IntelliSense Support (dotnet/aspnetcore-tooling#1675)
* <text> Tag IntelliSense Implementation

* Text node language context support

* Added Tests\n\nCommit migrated from a0f99cd14f
2020-03-12 22:45:50 -07:00
N. Taylor Mullen d69938f36d Initialize LSP documents earlier.
- Prior to this we would start tracking LSP documents when an `ITextView` was associated with our `ITextBuffer`. The issue with this is when the `ILanguageClient` infrastructure initializes itself before we do and starts our `LanguageServer` it's we start retrieving requests that require access to our `LSPDocumentManager`. That's an issue because our `LSPDocumentManager` may not have been initialized yet resulting in failure to fulfill requests.
- Changed how we initialize `ITextBuffer`s. Before we were setting up all of the logic to change the content type of a text buffer and populate its properties at the `EditorFactory` layer; however, how we were doing it (waiting for the ITextBuffer to load) resulted in `ITextDocumentListener` events firing prior to our content type changes would occur. This is a problem becasue the `ILanguageaClient` infrastructure will start making its decision to turn on LSP features for your `ITextBuffer` at the point and time. Now we change the `ITextBuffer`s content type (and set properties) during the `ITextDocumentListener` created pipeline.

This resulted in almost all of our logic in our editor factory to be split out into two classes.
  1. `LSPEditorFeatureDetector`, we needed to be able to detect the "enabledness" of features in two locations. Once at the `EditorFactory` layer to ensure we know when to disallow other editor factories participation in the `ITextBuffer` creation and a second at the `ITextDocumentListener` layer when we inspect an `ITextDocument` and need to determine if we want to "initialize" it (change its content type etc.).
  2. `RazorLSPTextDocumentCreatedListener`, this is our `ITextDocumentListener` i've been referring to. It now houses the logic on how to change the content type and populate the `ITextBuffer`'s properties.

- Changed our `LSPDocumentManager` to no longer depend on `ITextView`s for ref counting documents. Instead we just take an `ITextBuffer` and keep an internal count of how many times we've been asked to track a document. In practice this number never goes past 1 however it doesn't hurt to be defensive.
- Added IVT from CodeAnalysis.Razor to our LanguageServerClient project in order to enable the retrieval of our `FilePathComparison` type.
- Given the new refactoring of our feature detector and the `ITextDocumentListener` pieces I was able to add extensive testing to ensure all things work as expected.

Fixes dotnet/aspnetcoredotnet/aspnetcore-tooling#19160
\n\nCommit migrated from d0a7dfce09
2020-03-02 20:09:03 -08:00
N. Taylor Mullen b89d98da19 Split Razor Language Server into library and executable.
- This is a pre-requisite work item to run our language server in-process in Visual Studio. VS is a .NET framework application so we can't have a language server which targets netcoreapp be loaded. Therefore, in order to account for this I needed to re-target our language server library to netstandard2.0 so it can be referenced via a netcoreapp (rzls.exe) and a .NET framework app.
- Added a new `rzls` project to be the maintainer of our OOP language server
- Had to make adjustments to the existing language server project to be compatible with netstandard2.0.
- Created a new `RazorLanguageServer` type to initiate our Language Server but not start and initialize it. To enable a consumer to initialize the new language server I had to use private reflection to `Initialize` O#'s internal type. This is a temporary measure which I intend to expand the O# lib to make their Initialize method public.

dotnet/aspnetcoredotnet/aspnetcore-tooling#19185
\n\nCommit migrated from 79841b9371
2020-02-28 22:32:47 -08:00