Commit Graph

157 Commits

Author SHA1 Message Date
Pranav K 8fd85ec8ce
Ensure CircuitRegistry evicts CircuitHost entries after configured (#11157)
* Ensure CircuitRegistry evicts CircuitHost entries after configured
duration

* Use an active expiration token to trigger expiration
* Add logging during host state transitions

Fixes https://github.com/aspnet/AspNetCore/issues/9893
2019-06-17 13:15:15 -07:00
Pranav K 17c7ea95a2
Add API to configure CircuitOptions (#11166)
* Add API to configure CircuitOptions
2019-06-17 09:00:45 -07:00
Pranav K cd7eda9a33
Use a valid canceled task (#11161) 2019-06-14 13:13:53 -07:00
N. Taylor Mullen 874050f1dd Headless Blazor client (#11112)
* Add Ignitor
* Finish headless Blazor client.
* Added support for click events.
* Move Ignitor into testassets folder.
- Also added Ignitor to the no deps solution.
* Add Ignitor tests to validate RenderBatchReader stays consistent.
2019-06-13 10:05:40 -07:00
Pranav K d935ea2d25
Guarantee ordering for SignalR client HttpConnection.send #10780 (#10987)
Fixes https://github.com/aspnet/AspNetCore/issues/9901
2019-06-08 14:35:29 -07:00
Javier Calvarro Nelson 1165a6fb16
Support navigation during prerendering (#10694) 2019-06-01 01:40:45 +02:00
Javier Calvarro Nelson 2d2806b083
Better circuit ids (#10688)
* Better circuit ids.
* Generates cryptographically strong circuit ids.
  * 32 bits of entropy from a PRNG.
  * DataProtected for authenticated encryption.
2019-06-01 00:26:46 +02:00
Javier Calvarro Nelson 3c2e16bf92
Exposes the underlying HttpConnectionDispatcherOptions in MapBlazorHub (#10690)
* Expose new overloads to customize connection dispatch options
2019-05-31 22:25:08 +02:00
Ryan Nowak 2948c81aea
Fix RendererSyncContext.Post() (#10451)
* Fix RendererSyncContext.Post()

Fixes: #9683 - SignalR connection breaks on large DOM

The root cause here is a misbehaving sync context. It's not legal for a
Post() implementation to run a callback synchronously. We want that
behavior for most of the functionality Blazor calls directly, but Post()
should always go async or else various threading primitives are broken.

* Fix incorrect tests

These tests have the assumption that setting the result of a TCS will
execution continuations synchronously. This was a bug in our
SyncContext, and these tests needed updating to be more resiliant.

* Remove a delegate allocation
2019-05-23 10:39:53 -07:00
Pranav K b9546df5d4
Defer link interception until Router is initialized (#10062)
* Defer link interception until Router is initialized

Fixes https://github.com/aspnet/AspNetCore/issues/9834
2019-05-17 15:33:35 -07:00
Steve Sanderson 1dbc203e19
Components auth: basic services and components (#10227) 2019-05-16 09:59:12 +01:00
Nate McMaster 77e08c26d5
Replace all usages of RepositoryRoot with RepoRoot (#10267)
Preparing to adopt the Arcade SDK, which uses the shorter variable name instead
2019-05-15 12:00:19 -07:00
Ryan Nowak 0b590ff46f Fix #6764 EndpointConventionBuilder API review 2019-05-09 19:38:43 -07:00
Ryan Nowak b3836954ed Fix #9316 Expose Blazor HubOptions 2019-05-08 16:22:13 -07:00
Nick Sullivan 48d2f40192 blazor.boot.json - don't set physicalpath 2019-05-08 17:45:43 +01:00
Steve Sanderson e0c32f42f4
Key support. Implements #8232 (#9850)
* Store component/element keys on RenderTreeFrame

Also refactored how RenderTreeFrame gets constructed. The previous arrangement of having ad-hoc ctor overloads for different scenarios became intractible (too many combinations to avoid clashes; risk of accidentally losing field values when cloning). There's now one constructor per RenderTreeFrameType, so you always know where to add any new field values, and implicitly guarantees you don't lose other field values because adding a new param forces updates at all the call sites.

* Add StackObjectPool, which will be useful momentarily

* Support keyed insertions/deletions

* Refactor AppendDiffEntriesForRange to prepare for adding "move" logic

* Apply permutations on the JS side

* Handle keyed moves by writing a post-edit permutation list

* Shrink KeyedItemInfo struct

* Include sourcemaps when building client-side Blazor apps with ReferenceFromSource

* Update struct length of edit frames now it's explicit layout

It's longer now because all the reference-type fields, except the last, now have to be 8 bytes for compatibility with 64-bit runtimes. Previously on Mono WebAssembly the reference-type fields were all 4 bytes.

* Tolerate clashing keys (i.e., produce a valid diff, even if suboptimal)

* Tolerate keys being added/removed incorrectly

* E2E test harness for 'key'

* Some more unit test cases

* Invert diffing logic to prefer matching by key over sequence

Previously it preferred sequence over key, but that's wrong, and surfaces as bugs when you mix keyed and unkeyed items. We need to prefer key over sequence, because key is meant to guarantee preservation, whereas sequence is just best-effort preservation.

* Make unit test cases more adversarial

* First actual E2E test

* In E2E test, verify correct preservation of components

* E2E tests for simple insert/delete cases (with and without keys)

* E2E test for reordering. Also extend other tests to verify simultaneous editing.

* E2E test for many simultaneous changes

* Update reference sources

* CR: Avoid x = y = z

* CR: Only use 'finally' for actual cleanup

* CR: Clean up RenderTreeFrame assignment

* CR: Include 'key' in RenderTreeFrame.ToString()

* CR: Avoid "new T()" in StackObjectPool

* CR: Make KeyedItemInfo readonly

* CR: Handle change of frame type with matching keys (and sequence)

* CR: Add E2E test showing form + key scenarios

* Preserve focus across edits

* Tweak E2E test case

* In client-side Blazor, prevent recursive event handler invocations

* Actual E2E tests for moving form elements
2019-05-07 18:22:10 +01:00
BrennanConroy 14496c9989
React to SignalR hub protocol change (#10010)
https://github.com/aspnet/AspNetCore/issues/5320
2019-05-07 08:18:12 -07:00
Pranav K 3c40df452d
Update MessagePack commit to be inline with upstream changes (#9753)
* Update MessagePack commit to be inline with upstream changes
2019-05-03 10:43:45 -07:00
James Newton-King da66edc8ff
Change IEndpointConventionBuilder extension methods to use generic argument (#8906) 2019-05-02 07:25:54 +12:00
Pranav K 9e4d5c14c7
Use LogicalName that works consistently in all platforms (#9527) 2019-04-18 19:27:25 -07:00
Pranav K 11842e75e2
Update MessagePack and fix build warning (#9464) 2019-04-18 10:06:58 -07:00
Pranav K 56e2080ef7
Always fully build Components.Server.csproj (#9421)
* Always fully build Components.Server.csproj

* Use pre-built js files instead of building on the fly
* Use a sourcemap file for Debug. .gitignore sourcemap files
* Install nodejs on CodeCheck agents

Fixes https://github.com/aspnet/AspNetCore/issues/9402
2019-04-17 09:17:42 -07:00
Hao Kung 9e4647d6e4
Reenable Components.Server.Tests (#9432) 2019-04-16 15:20:41 -07:00
Steve Sanderson eaf63a670d Fix log message in RemoteRenderer 2019-04-05 17:05:17 +01:00
Pranav K 896537bb8c Update MessagePack-CSharp commit 2019-04-05 06:50:30 -07:00
Ryan Nowak b142daeccb [Blazor] Fix #9089 don't log mundane stuff at info level (#9098)
Reduce the noise of some logging that's really
only useful for troubleshooting/debugging.
2019-04-05 06:45:33 +02:00
Javier Calvarro Nelson b9e600a45c
Renames for blazor server-side, inclusion in shared framework, and other renaming fixes (#9001)
* Move contents of Microsoft.AspNetCore.Components.Services namespace to Microsoft.AspNetCore.Components
* Rename Components to Blazor
* Make Blazor server-side part of the shared framework.
2019-04-04 21:36:36 +02:00
Steve Sanderson 42511e8652
Replace Blazor CLI tool with new DevServer package (#9028) 2019-04-04 09:47:56 +01:00
Javier Calvarro Nelson 8499a27c7f
[Components] Relayer + Robust reconnect (#8911)
* [MVC][Components] Prerendering + Robust reconnect
* Relayers prerendering support on a separate package on top of MVC and
  components.
* Implements robust reconects with acknowledgements from the client.
* Improves interactive prerendering with the ability to reconnect to
  prerendered components.
* Removes the need to register components statically when prerendering
  them.
* Removes the need of using an element selector when prerendering an
  interactive component.
* Updates the templates to use the new fallback routing pattern and
  reenables the components test.
* Adds eslint to the Typescript project to help maintain a consistent
  style.
* Adds logging to support better debugging based on the pattern used by
  signalr.
* Fixes exception handling on the server to always report exceptions correctly to the client.
2019-04-02 19:17:03 +02:00
Pranav K d86c9b3f07
Use MessagePackReader \ MessagePackWriter to implement IHubProtocol for server-side Blazor (#8687)
* Use MessagePackReader \ MessagePackWriter to implement IHubProtocol for server-side Blazor

Fixes #7311
2019-04-01 14:25:23 -07:00
Steve Sanderson 77d9fae439
Supply "IsConnected" state info to components (#8888)
* Basic implementation of IComponentContext with IsConnected flag

* Update ref assembly code

* Begin infrastructure for prerendered E2E tests

* Actual E2E test for prerendered-to-interactive transition
2019-03-29 14:53:29 +00:00
Steve Sanderson 49b074d3c0
Fix base URI during prerendering (#8910) 2019-03-29 12:41:59 +00:00
Ryan Nowak 658b37d2bd
Make UseEndpoints a thing (#8765)
* Make endpoint middleware explicit

This change makes the endpoint middleware explicit again, and updates
all of the templates.

The other change here is make UseEndpoints be the place where you
register endpoints. This is vital because it puts your code visually at
the point of the pipeline where it executes.

Lastly, I removed support for UseMvc with endpoint routing. This is
causing issues for some security features, and we're moving in the
direction of trying to make the middleware heavy implementation required
in 3.0. There are some issues we won't be able to fix in MVC if we can't
unambiguously know if UseMvc was used or the middleware.
2019-03-28 15:41:11 -07:00
Steve Sanderson 03357bf92b
Components: don't block the SignalR loop during init. Fixes #8274 (#8863) 2019-03-28 16:42:55 +00:00
Pranav K cb6fb32529
Make building Components & Mvc solutions work out of the box (#8830)
* Make building Components & Mvc solutions work out of the box

Fixes https://github.com/aspnet/AspNetCore/issues/8413
2019-03-27 09:27:11 -07:00
Ryan Nowak b743ba2f66 Throw unhandled exceptions during prerendering
Fixes: #8609

Currently exceptions thrown during prerendering are simply logged. This
change uses the existing *unhandled exception* mechanism of the
renderer/circuit to throw these. The result is that the developer
exception page just works for prerendering.
2019-03-20 13:02:24 -07:00
Pranav K 33839dc66a
Client reconnects when state's available on the server (#7395)
Reconnect if we have state on the server

Fixes #7537
2019-03-04 17:27:51 -08:00
Ryan Nowak cb21edc500
Fix #7258 - remove components.server dependencies on blazor-specific plumbing (#7934)
* Removes a bunch of trivial usage of Blazor

... in names and comments where we don't specifically mean Blazor.

* Remove obsolete Startup from Components app

* Move UseBlazor into Blazor.Server

Moves UseBlazor and the related features in Blazor.Server - along with
some other general cleanup of misc shared files.

Now Components.Server has a much slimmer set of dependencies (MVC is
gone) and doesn't contain the "double startup" pattern that we
introduced (sorry).

We'll revisit UseBlazor and the dependencies there once the new
MapFallbackToFile support is available from static files.

* minor PR feedback

* Update reference assemblies

* fix broken test
2019-02-28 10:36:07 -08:00
Nate McMaster 7fe3b7640d
Merge branch 'release/3.0-preview3' 2019-02-22 15:07:50 -08:00
Javier Calvarro Nelson 2d9cba86fd [Components] Prerrendering startup experience (#7770)
[Components] Prerrendering startup experience
* Introduces an IComponentPrerrenderer to handle Prerrendering
  * MVC registers a basic static prerrrenderer.
  * Components registers a more feature complete prerrender that will
    handle reconnection to the original circuit after prerrendering in
    the future to allow for prerrendered interactive components.
* Removes UseRazorComponents
  * Removes the SPA fallback in favor of a catch all route in
    Index.cshtml
  * Moves the framework files to be served by the default StaticFiles
    middleware in the pipeline by way of plugging specific providers
    through options.
  * Lifts UseSignalR(r => r.MapHub<ComponentHub>()) into startup and
    replaces it with a shorthand for MapHub using endpoint routing.
  * Adds extension methods to map components to selectors for a given
    hub.
* Updates the razor component templates to include prerendering and use a razor page as the entry 
   point.
2019-02-21 16:26:44 -08:00
Pavel Krymets 9355c7c1a5
Add reference assemblies support (#7764) 2019-02-21 14:33:35 -08:00
Chris Ross 4e44025a52
Replace IHostingEnvironment with IWebHostEnvironment (#7725) 2019-02-19 21:11:52 -08:00
Pranav K cddbc2e888
Improve Components error handling (#7165)
* Improve Components error handling

* Change event handlers IHandleEvent, IHandleAfterEvent to be async.
* Return faulted tasks to Renderer instead of handling exceptions in ComponentBase
* Use ILogger in RemoteRenderer, and log to console in WebAssemblyRenderer
* Cleaning up touched files

Fixes https://github.com/aspnet/AspNetCore/issues/4964
2019-02-13 14:22:46 -08:00
Artak 7c9959934a Fixed a type reference in a doc comment.
Fixes #7416
2019-02-11 09:06:34 -08:00
Hao Kung c9499e14e4
Run helix tests on master (#6728) 2019-02-07 09:20:08 -08:00
Javier Calvarro Nelson f456e3d153
[Components] [Fixes #6953, #7226]
* Moves the Synchronization context from the remote renderer to the base renderer.
* Removes all the locking from the base renderer.
2019-02-07 07:03:52 -08:00
Pranav K 2e54d6485b
Introduce CircuitHandler to handle circuit lifetime events (#6971)
Introduce CircuitHandler to handle circuit lifetime events

Partial fix to https://github.com/aspnet/AspNetCore/issues/6353
2019-02-04 10:53:01 -08:00
Pranav K 62d10bc08e
Changes per PR 2019-02-04 09:50:12 -08:00
Pranav K 92df79b270
Remove unused 2019-02-04 09:38:40 -08:00
Pranav K f1e70ec897
More PR changes 2019-02-04 09:38:40 -08:00
Pranav K cec47f05e2
Fix names and grammar 2019-02-04 09:38:40 -08:00
Pranav K e312d64194
[Design]: Introduce CircuitHandler to handle circuit lifetime events
Partial fix to https://github.com/aspnet/AspNetCore/issues/6353
2019-02-04 09:38:39 -08:00
Nate McMaster 6081fec894
Add new build.cmd/sh options for suppressing restore, NodeJS, setting target arch and OS name, and more (#7137)
Add new command line parameters for working with the project:

* `-NoBuild`, `-NoRestore` - these already existed, but users found it hard to discover this powershell syntax: '-build:$false'
* `-Arch`/`--arch` - set the target CPU architecture to build. Defaults to x64
* `--os-name` - on non-Windows builds, manually specify if the build should target Alpine. generic Linux, or MacOS
* Rename flags used to build specific project types. The pattern now is `--build-$(group)` or `--no-build-$(group)` (In PowerShell its `-Build$(Group)` or `-NoBuild$(Group). Example: -NoBuildJava

Changes to build definitions:
* Update the ci build definition to build all supported architectures
* Support publishing multiple artifacts per job

Other changes:
* `-NoBuild` implies `-NoRestore`
* Add new properties, `TargetArchitecture`, `TargetOsName`, and `TargetRuntimeIdentifier`
* Replace usages of `SharedFxRid` with these new properties
* To make `--no-build-nodejs` actually work, replaced Components.Browser.JS.csproj with Components.Browser.JS.npmproj
* Fix errors when building for win-arm on a clean machine
* Fix a few other project errors, like using the wrong syntax for DefaultItemExcludes, or using the wrong Platform value for x86
2019-01-31 15:47:47 -08:00
Steve Sanderson c901cc069d Rename IBlazorApplicationBuilder->IComponentsApplicationBuilder 2019-01-18 14:22:37 -08:00
Nate McMaster 922512a9fb
Convert the artifacts folder layout to match Arcade (#6850)
Changes:
* IsProductPackage => IsShippingPackage
* artifacts/$config/packages => artifacts/packages/$config
* packages/product => packages/Shipping
* packages/internal => packages/NonShipping
* Renamed MSBuild properties used for output folders
* Update build tools to use 2 spaces in global.json
2019-01-18 13:38:24 -08:00
Javier Calvarro Nelson 19b543e45f [Components] Support for prerrendering asynchronous components.
* Updates the IComponent interface to rename Init into Configure
* Updates the IComponent interface to change SetParameters for
  SetParametersAsync and make it return a Task that represents when the
  component is done applying the parameters and potentially triggering
  one or more renders.
* Updates ComponentBase SetParametersAsync to ensure that OnInit(Async)
  runs before OnParametersSet(Async).
* Introduces ParameterCollection.FromDictionary to generate a parameter
  collection from a dictionary of key value pairs.
* Introduces RenderComponentAsync on HtmlRenderer to support
  prerrendering of async components.
* Introduces RenderRootComponentAsync on the renderer to allow for
  asynchronous prerrendering of the root component.
2019-01-17 08:39:00 -08:00
Nate McMaster 5a70f5312f
Convert Components projects to use ProjectRef (#6698)
This addresses #4246 for src/Components/. A few other changes were necessary because components had been using stale dependencies.
2019-01-16 12:28:04 -08:00