Commit Graph

180 Commits

Author SHA1 Message Date
Nate McMaster dc90e11c7a
Move obj and bin directories into repo root (#10063)
The Arcade SDK requires that the obj/ and bin/ folders be placed in the top-level artifacts/ folder of the repo. Although this PR does not complete our Arcade convergence, this is a step towards updating our repo to build with the Arcade SDK.

Changes:
* Set output path for build to artifacts/bin/$(ProjectName)/ 
* Set intermediate output path for build to artifacts/obj/$(ProjectName)/
* Cleanup .gitignore files (remove duplication between repo-root and tested gitignore files)
* Add code check which looks for project files that share the same name (could cause issues)
* Rename project files to have unique names (avoid race condition of build output)
* Update all locations which were hard-coded to expect bin/ and obj/ in the project directory
* Add overrides for tests which still assert test binaries exist in a given location relative to the source code
2019-05-15 13:44:55 -07:00
Steve Sanderson 4db8260c6c
Fix components event dispatch ordering + E2E test fixes (#10112) 2019-05-09 18:32:26 +01:00
Ryan Nowak b3836954ed Fix #9316 Expose Blazor HubOptions 2019-05-08 16:22:13 -07:00
Steve Sanderson e0007f4f4b Improve robustness of components Bind and EventBubbling E2E tests 2019-05-08 13:53:04 +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
Ryan Nowak d3400f7cb2
Fix: #6882 - Explode UseBlazor (#9449)
This changes the recipe for client-side blazor to use similar primitives
to server side applications.

---

I ignored auto-rebuild support because it's currently dead code until we
have that in VS. If we add auto-rebuild to ASP.NET Core - we'd probably want
to make that a separate gesture inside `IsDevelopement()` like other
dev-time features anyway.

---

The static files hookup is a special thing because creating the file
server for a client-side Blazor app involves some non-trivial work. We
plan to make this better in the future.

What's nice about this pattern is that the implementation is pretty
simple and literal, and it scales fine if you have multiple Blazor
client-side apps.

I didn't provide a lot of options here, it's pretty much the same as
UseBlazor.

---

I feel pretty good about the wireup with routing to use the
`index.html` from the client app. I think it's pretty to-the-point.
2019-05-06 18:09:26 -07:00
James Newton-King da66edc8ff
Change IEndpointConventionBuilder extension methods to use generic argument (#8906) 2019-05-02 07:25:54 +12:00
Steve Sanderson 110e41f741 Fix InputCheckbox when initially checked. Fixes #8502 2019-04-22 15:56:30 +01:00
Pranav K 9e4d5c14c7
Use LogicalName that works consistently in all platforms (#9527) 2019-04-18 19:27:25 -07:00
Pranav K 004ac25983
Remove AddRazorSupportForMvc from MVC and Blazor projects (#9446)
Fixes https://github.com/aspnet/AspNetCore/issues/9126
Fixes https://github.com/aspnet/AspNetCore/issues/9183
Fixes https://github.com/aspnet/AspNetCore/issues/9207
2019-04-16 20:46:51 -07:00
BrennanConroy 9fae14a926
System.Text.Json Hub Protocol (#8932) 2019-04-13 09:20:30 -07:00
Pranav K b93bc433db
Make AuthorizeFilter work in endpoint routing (#9099)
* Make AuthorizeFilter work in endpoint routing

Fixes https://github.com/aspnet/AspNetCore/issues/8387
2019-04-08 06:03:34 -07: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 57940a23aa
[Components] Avoid creating two connections when resuming circuits
* Fix double connection bug

* Fix broken tests

* Add test to detect two connections

* clean up tests

* Fix test bug

* Isolate duplicate connection tests
2019-04-04 08:19:05 +02:00
Ryan Nowak f2e9ef3441 Improve initialization and SignalR configuration
Fixes: #6887 and #6887 and #5624

Adds support for calling Blazor.start({...}) and passing in a
configuration object.

For now all you can configure is the SignalR HubConnectionBuilder. This
is a priority right now because we want to make configuring SignalR's
logging accessible.
2019-04-02 15:33:42 -07: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
Steve Sanderson 7f4dd27551
Support triggering rendering from OnAfterRenderAsync. Fixes #8435 (#8960) 2019-04-01 13:01:33 +01: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
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
Ryan Brandenburg 70cd5f5f9f
Mark tests flaky instead of skipped (#8727)
Mark tests flaky instead of skipped
2019-03-26 09:51:37 -07:00
Pranav K 9a35bbea03
Experience for Razor SDK (#8731)
* Experience for Razor SDK

* Remove Components.Build
* Update MVC projects and templates to use AddRazorSupportForMvc
* Update components templates to use .razor extension

Fixes https://github.com/aspnet/AspNetCore/issues/6392

* Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190321.3

- Microsoft.NET.Sdk.Razor - 3.0.0-preview4.19171.3
- Microsoft.CodeAnalysis.Razor - 3.0.0-preview4.19171.3
- Microsoft.AspNetCore.Razor.Language - 3.0.0-preview4.19171.3
- Microsoft.AspNetCore.Mvc.Razor.Extensions - 3.0.0-preview4.19171.3

* Update dependencies from https://github.com/dotnet/core-setup build 20190322.01

- Microsoft.NETCore.App - 3.0.0-preview4-27522-01

Dependency coherency updates

- Microsoft.Bcl.Json.Sources - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- Microsoft.CSharp - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- Microsoft.Win32.Registry - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.ComponentModel.Annotations - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Data.SqlClient - 4.7.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Diagnostics.EventLog - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.IO.Pipelines - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Net.Http.WinHttpHandler - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Net.WebSockets.WebSocketProtocol - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Reflection.Metadata - 1.7.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Runtime.CompilerServices.Unsafe - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Security.Cryptography.Cng - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Security.Cryptography.Pkcs - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Security.Cryptography.Xml - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Security.Permissions - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Security.Principal.Windows - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.ServiceProcess.ServiceController - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Text.Encodings.Web - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- System.Threading.Channels - 4.6.0-preview4.19164.7 (parent: Microsoft.NETCore.App)
- Microsoft.Extensions.DependencyModel - 3.0.0-preview4-27522-01 (parent: Microsoft.NETCore.App)
- Microsoft.NETCore.Platforms - 3.0.0-preview4.19164.7 (parent: Microsoft.NETCore.App)

* Update dependencies from https://github.com/aspnet/EntityFrameworkCore build 20190321.4

- Microsoft.EntityFrameworkCore.Tools - 3.0.0-preview4.19171.4
- Microsoft.EntityFrameworkCore.SqlServer - 3.0.0-preview4.19171.4
- dotnet-ef - 3.0.0-preview4.19171.4
- Microsoft.EntityFrameworkCore - 3.0.0-preview4.19171.4
- Microsoft.EntityFrameworkCore.InMemory - 3.0.0-preview4.19171.4
- Microsoft.EntityFrameworkCore.Relational - 3.0.0-preview4.19171.4
- Microsoft.EntityFrameworkCore.Sqlite - 3.0.0-preview4.19171.4

* Update dependencies from https://github.com/aspnet/Extensions build 20190321.4

- Mono.WebAssembly.Interop - 3.0.0-preview4.19171.4
- Microsoft.JSInterop - 3.0.0-preview4.19171.4
- Microsoft.Internal.Extensions.Refs - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Diagnostics.HealthChecks - 3.0.0-preview4.19171.4
- Microsoft.Extensions.DiagnosticAdapter - 3.0.0-preview4.19171.4
- Microsoft.Extensions.DependencyInjection.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.DependencyInjection - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.Xml - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.UserSecrets - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.KeyPerFile - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.Json - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.Ini - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.FileExtensions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.EnvironmentVariables - 3.0.0-preview4.19171.4
- Microsoft.Extensions.FileProviders.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.CommandLine - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.AzureKeyVault - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration - 3.0.0-preview4.19171.4
- Microsoft.Extensions.CommandLineUtils.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Caching.StackExchangeRedis - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Caching.SqlServer - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Caching.Memory - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Caching.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.ActivatorUtilities.Sources - 3.0.0-preview4.19171.4
- Microsoft.AspNetCore.Testing - 3.0.0-preview4.19171.4
- Microsoft.AspNetCore.BenchmarkRunner.Sources - 3.0.0-preview4.19171.4
- Microsoft.AspNetCore.Analyzer.Testing - 3.0.0-preview4.19171.4
- Internal.AspNetCore.Analyzers - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Configuration.Binder - 3.0.0-preview4.19171.4
- Microsoft.Extensions.FileProviders.Composite - 3.0.0-preview4.19171.4
- Microsoft.Extensions.FileProviders.Embedded - 3.0.0-preview4.19171.4
- Microsoft.Extensions.FileProviders.Physical - 3.0.0-preview4.19171.4
- Microsoft.Extensions.WebEncoders - 3.0.0-preview4.19171.4
- Microsoft.Extensions.ValueStopwatch.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.TypeNameHelper.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Primitives - 3.0.0-preview4.19171.4
- Microsoft.Extensions.ParameterDefaultValue.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Options.DataAnnotations - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Options.ConfigurationExtensions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Options - 3.0.0-preview4.19171.4
- Microsoft.Extensions.ObjectPool - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.TraceSource - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.Testing - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.EventSource - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.Debug - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.Console - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.Configuration - 3.0.0-preview4.19171.4
- Microsoft.Extensions.FileSystemGlobbing - 3.0.0-preview4.19171.4
- Microsoft.Extensions.HashCodeCombiner.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.HostFactoryResolver.Sources - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Hosting - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Hosting.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Http - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Localization - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Localization.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.Abstractions - 3.0.0-preview4.19171.4
- Microsoft.Extensions.Logging.AzureAppServices - 3.0.0-preview4.19171.4

* Grab latest from other aspnet repos
- brings everything into coherence
- aspnet/Extensions packages with version 3.0.0-preview4.19172.1 from build 20190322.1
- aspnet/AspNetCore-Tooling packages with version 3.0.0-preview4.19172.2 from build 20190322.2
- aspnet/EntityFrameworkCore packages with version 3.0.0-preview4.19172.3 from build 20190322.3
2019-03-22 17:33:20 -07:00
Javier Calvarro Nelson 5f4be179e3
Fix and identify flaky components E2E Tests (#8690) 2019-03-21 07:39:47 +01: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
Javier Calvarro Nelson 9f1a978230
[Infrastructure improvements] (#8275)
* Improved selenium start and tear down
  * Selenium is set up and torn down in an assembly fixture.
  * Selenium is initialized lazily and in a non-blocking way.
  * Selenium processes are tracked as part of the build and their pids
    written to a file on disk for cleanup in the event of unexpected
    termination of the test process.
  * Browser fixture retries with linear backoff to create a remote
    driver. Under heavy load (like when we are doing a simultaneous NPM
    restore) the selenium server can become unresponsive so we retry
    three times, with a longer comand timeout allowance each time up to
    a max of 3 minutes.
* Moved test project setup to build time instead of runtime.
  * Added target PrepareForTest to create the required files for testing
    * The template creation folder.
    * The template props file to use our built packages.
    * The folder for the custom hive.
  * Added assembly metadata attributes to find all the data we need to
    run the tests.
    * Path to the artifacts shipping packages folder.
    * Path to the artifacts non-shipping packages folder.
    * Path to the test templates creation folder.
    * Path to use for the custom templating hive used in tests.
  * Proper cleanup as part of the build
    * Remove the test templates creation folder.
    * Remove the test packages restore path.
    * Recreate the test templates creation folder.
    * Recreate the test packages restore path.
  * Generated Directory.Build.Props and Directory.Build.Targets in the
    test templates creation folder.
  * Cleaned up potentially stale templatetestsprops.
* Improved test flows
  * Initialization is done lazily and asynchronously.
    * Selenium
    * Browser fixture
    * Template initialization.
  * Flattened test flows to avoid assertions inside deep callstacks.
    * All assertions happen at the test level with improved error messages.
      * With the exception of the migrations assertions.
    * Assertions contain information about which step failed, for what
      project and what failure details.
  * Broke down tests to perform individual steps instead of mixing build
    and publish.
    * Publish project.
    * Build project. (Debug)
    * Run built project.
    * Run published project.
  * Concentrated build logic into the Project class.
    * Context between the different steps of a test is maintained in
      this class.
    * All operations that require coordination are performed within this
      class.
      * There is a lock for dotnet and a lock for nodejs. When building
        SPAs we acquire the nodejs lock to correctly prevent multiple
        runs of nodejs in parallel.

[ApiAuthorization template cleanups]
  * Fix preview3 issues with breaking changes on Entity framework by
    manually configuring the model in ApiAuthorizationDbContext.
  * Add app.db to the project file when using local db.
  * Fix linting errors on angular template.
  * Fix react tests
  * Add tests to cover new auth options in the SPA templates.
2019-03-20 08:44:20 +01:00
Javier Calvarro Nelson d7a9606040
[Templating][Components] Unify and improve E2E testing infrastructure (#8188)
* Unify the Templating and Components testing infrastructure.
* Enable test project discovery in the components E2E tests.
* Enable selectively disabling Selenium tests through build properties.
2019-03-11 18:40:18 +01: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
Doug Bunting d515bd977f
Merge branch 'master' into merge/release/3.0-preview3-to-master 2019-02-25 15:56:46 -08:00
Steve Sanderson 87f4ca7299
[Templates] Imports and CSS tweaks for forms/validation (#7914)
* Add Microsoft.AspNetCore.Components.Forms to default Components imports

* Add default validation CSS rules in Components/Blazor templates

* Add default validation CSS styles to Components testassets projects
2019-02-25 21:50:12 +00:00
Steve Sanderson 61098b6680
Make InputBase use EventCallback for ValueChanged (#7915)
* Make InputBase use EventCallback for ValueChanged

... so that the host component gets re-rendered automatically after each value change (like when binding to DOM elements).

* Improve E2E test code

... so that the host component gets re-rendered automatically after each value change (like when binding to DOM elements).
2019-02-25 21:49:28 +00:00
Nate McMaster 7fe3b7640d
Merge branch 'release/3.0-preview3' 2019-02-22 15:07:50 -08:00
Nate McMaster 5be7d30231 Replace npm commands with yarn 2019-02-22 13:30:19 -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
Ryan Nowak ebb527d347 [wip] Update Razor SDK and resolve issues
I'm still chasing one more issue.

(cherry picked from commit 616a4a36f5)
2019-02-21 11:42:23 -08:00
Ryan Nowak 616a4a36f5 [wip] Update Razor SDK and resolve issues
I'm still chasing one more issue.
2019-02-21 09:14:17 -08:00
Ryan Brandenburg 5a7bfbbc01
Use Bootstrap 3.4.1 and 4.3.1 (#7719)
Use Bootstrap 3.4.1. and 4.3.1
2019-02-20 15:55:49 -08:00
Nate McMaster 85ae18c723
Make Visual Studio 2019 a prerequisite to building this repo (#7005)
Changes:

* Make Visual Studio 2019 a prerequisite for building this repo
* Update .sln files
* Update Windows SDK to 17134
* Update developer docs
* Disable ANCM tests
* Update to .NET Core SDK 3.0 Preview 2
* Use Microsoft.NET.Sdk.Razor as a package consistently accross the repo
* React to changes in metadata from Microsoft.NETCore.App
* React to changes in .NET Core SDK
* Attempt to workaround CodeCheck.ps1 failure which doesn't repro locally or on different agents. Possibly due to differences in the version of the PowerShell task?
* Remove dead YML file
* Rename usages of win7-{x64,x86} to win-{x64,x86}
* Update KoreBuild to 3.0.0-build-20190219.1
2019-02-20 09:53:53 -08:00
Steve Sanderson 7a2dfd3200
Components: Forms and validation (#7614) 2019-02-20 09:56:32 +00:00
Chris Ross 4e44025a52
Replace IHostingEnvironment with IWebHostEnvironment (#7725) 2019-02-19 21:11:52 -08:00
Ryan Nowak 98fe8a8328 Improvements to bind and event handling
The changes here make event dispatching (including bind) more
user-friendly by avoiding the need for manual calls to StateHasChnaged.

We also introduce a new type `EventCallback` (and `EventCallback<T>`).
This is a new primitive that is like a super-powered version of a
delegate. When writing a component that accepts delegates as parameters,
consider using `EventCallback` for the following reasons:
- Allows consumer to pass a variety of different delegate signatures
- Does proper event dispatching and error handling

Using `EventCallback` will eliminate most of the remaining cases where a
manual `StateHasChanged` is required when components are passing content
and delegates to each other.

`EventCallback` is inherently async for the reason that this is really
the only way to provide correct error handling.

-----

The fix for this will be two-phase by first creating a set of APIs that
can be targeted by the compiler that has the desired behaviour and then
updating the compiler to target this new infrastructure.
2019-02-17 15:58:08 -08:00
Pranav K fe1c2c84ee
Remove uses of JSRuntime.Current (#7599)
* Remove uses of JSRuntime.Current

Prerequisite for https://github.com/aspnet/AspNetCore/issues/6828
2019-02-15 15:14:00 -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
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 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
Pranav K 16228c646a
Changes per PR 2019-01-25 13:53:07 -08:00
Pranav K c8319ece2a
Cleanup some infrastructure pieces in Components 2019-01-25 13:51:03 -08:00
Steve Sanderson a1d49e19b5 Revert feature that resets unspecified parameters to default(type). Fixes #6864 (#6931) 2019-01-22 16:16:07 -08:00
Steve Sanderson c901cc069d Rename IBlazorApplicationBuilder->IComponentsApplicationBuilder 2019-01-18 14:22:37 -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
Pranav K b56c589773
Dispose components on client disconnects (#6693)
* Dispose components on client disconnects
Fixes https://github.com/aspnet/AspNetCore/issues/4047
2019-01-15 14:52:40 -08:00
Steve Sanderson cbbdeaefd4
Enforce correct sync context on render, and allow explicit dispatch to sync context. Fixes #5639 (#6604)
* Only use async marshalling to renderer sync context when necessary

Note that the lifecycle methods already take care of capturing the correct sync context, so continuations will already be serialized.
Avoiding an extra layer of asynchrony keeps the semantics of rendering closer to the WebAssembly cases, and will fix a range of intermittent errors in the wild.

* Add E2E test of triggering rendering from outside the sync context

* Actually throw if attempting to render from incorrect sync context

* Add "Dispatch" API

* Handle dispatch within dispatch. Also test Dispatch on WebAssembly.

* Avoid heap allocation

* Simplify E2E test

* Replace Dispatch() with Invoke() and InvokeAsync()

* Add E2E test to validate async execution order

* Clean up
2019-01-14 15:31:53 +00:00
Steve Sanderson 70cdf11f76
Make Razor Components apps not use Blazor build (#6562)
* Replace UseServerSideBlazor with UseRazorComponents, which doesn't require Blazor build artifacts

* Make UseRazorComponents serve blazor.server.js from embedded resource

... so we don't need a build step to put it on disk somewhere.

* Fix TestServer

* Update ComponentsApp not to use Blazor build targets

* Update ComponentsApp.App sample to use new build package

* Update string constant in test

* Rename blazor.*.js to components.*.js

* Ensure correct build order

* Update nav menu title in Components sample app

* Fix remaining paths

* Switch ComponentsApp.App to use Sdk="Microsoft.NET.Sdk.Razor"

* Update mono.cecil version

* CR: Replace FrameworkFilesProvider with EmbeddedFileProvider

* CR: Use ManifestEmbeddedFileProvider
2019-01-11 16:14:11 +00:00
Steve Sanderson 8446b260d9
Split .Components.Build into .Blazor.Build+.Components.Build (#6538)
* Move Components.Build to blazor/src/. No content changes yet.

* Rename Components.Build to Blazor.Build and update file paths

* Move Components.Build.Test files. No content changes yet.

* Update contents in Blazor.Test

* Fix names of props/targets files

* Add minimal Components.Build package that just imports Razor targets and analyzer

* Make Blazor.Build depend on Components.Build and get Razor compilation targets from there

* Fix version of reference from .Blazor.Build to .Components.Build

* Fix signing error on local builds

* Update artifacts.props
2019-01-10 11:23:36 +00:00
Pranav K 6b0c0761a4 Avoid doing selenium 2019-01-09 17:17:22 -08:00
Steve Sanderson 326e329018
Run components E2E tests in CI (#5158)
* Auto-install local copy of selenium-standalone on build

* Automatically start/stop selenium-standalone when running E2E tests

* Update after rebase

* Exclude node_modules from E2ETests project

* Avoid deadlocks

* Include E2E tests when running all tests in src/Components

* Be more forgiving about waiting for selenium-server to be ready

* Update usage of shared source file
2019-01-08 16:07:07 +00:00
Ryan Nowak 9003c3cd75 PR Feedback
From:
2cb3964411..45adea0c6d (diff-9328b73f3a66921c3ef3fa8a4ce90031)
2019-01-04 13:38:32 -08:00
Ryan Nowak b1f4a7bafd Delete baseline files 2019-01-02 00:32:09 -08:00
Ryan Nowak 0dd1bf8cd3 Make the tests pass
- Remove baseline tests. Those live with tooling
- Unskip tests that should have been fixed years ago
- Fix rendering test infrastructure
2019-01-02 00:32:09 -08:00
Ryan Nowak bdb5982dbd Remove Blazor Compiler 2019-01-02 00:32:09 -08:00
Ryan Nowak 9e89a69a78 Update RazorCompilation.targets for new SDK 2019-01-02 00:32:09 -08:00
Ryan Nowak 4424594c9b Allow build to specify Razor SDK version 2019-01-02 00:32:09 -08:00
Ryan Nowak 688ab7fc49 Fix dotnet-blazor serve
This wasn't properly forwarding the base path to the configuration.
Basically nothing was setting RemainingArguments. We have a test project
that sets the base path, but it was never used when debugging locally.

I also cleaned this up a bit and changed it to use dotnet exec. This
allow you to debug the CLI and related server pipeline, but has the
tradeoff of not rebuilding.
2019-01-02 00:32:09 -08:00
Ajay Bhargav Baaskaran ffec555118 Added missed files 2018-12-18 15:35:38 -08:00
Ajay Bhargav Baaskaran 2a696f6a1c Merge branch 'release/2.2' 2018-12-18 12:50:01 -08:00
Steve Sanderson ceb1c8e562
Refactor Components.Browser package (#5166)
* Add empty Microsoft.AspNetCore.Blazor project

* Reorganize Blazor-specific parts of .Components.Browser into Microsoft.AspNetCore.Blazor. Delete redundant Components-CSharp template (it now ships from Templating).

* Fix unit test

* Add missing assembly description

* Move WebAssemblyBlazorApplicationBuilder

* Rename BrowserHttpMessageHandler -> WebAssemblyHttpMessageHandler

* Delete obsolete BrowserServiceProvider. Rename BrowserRenderer -> WebAssemblyRenderer.

* Rename BrowserUriHelper -> WebAssemblyUriHelper

* Remove redundant ActivateMonoJSRuntime helper

* Fix namespace

* Remove redundant MicrosoftNETCoreAppPackageVersion override

* Update test namespaces
2018-12-18 12:32:57 +00:00
Javier Calvarro Nelson 436b5461ad
[Components] Create a renderer to render components into HTML (#4463)
* Adds an HtmlRenderer to Microsoft.AspNetCore.Components
 * It renders the component into a list of strings.
 * It only handles synchronous rendering.
2018-12-14 21:28:05 +01:00
Steve Sanderson ec9676f51e
Make component parameter analyzer allow public getters. Imported from Blazor PR 1702. (#4594) 2018-12-14 18:50:45 +00:00
Steve Sanderson d30c407dd0
Support IServiceProviderFactory in WebAssemblyHostBuilder (imported from Blazor PR 1623) (#4785) 2018-12-14 17:37:14 +00:00
Steve Sanderson 343208331d
Replace AssignToProperties with SetParameterProperties, which also clears unspecified parameter properties (imported from Blazor PR 1108) (#4797) 2018-12-14 17:07:07 +00:00
Steve Sanderson 3757908b14
Fallback for Components router (imported from Blazor PR 1534) (#4794) 2018-12-14 17:06:47 +00:00
Steve Sanderson e768a78c2b
Ensure ComponentBase async lifecycle methods return non-null task (imported from Blazor PR 1620) (#4790) 2018-12-14 17:06:30 +00:00
Steve Sanderson 8a9df6c873
HttpClientJsonExtensions better handling for failed requests (imported from Blazor PR 1660) (#4788) 2018-12-14 17:06:03 +00:00
Steve Sanderson 93127b39e8
Overload UriHelper to forceLoad the page (imported from Blazor PR 1154) (#4786) 2018-12-14 17:05:45 +00:00
Steve Sanderson 8fbb9fb0e6
Add support for binding decimal? double? float? long? int? bool? (imported from Blazor PR 1658) (#4600) 2018-12-14 17:05:22 +00:00
Steve Sanderson 5c1fbe1af7
Run Components on netcoreapp3.0 (#4391) 2018-12-05 14:46:26 +00:00
Steve Sanderson 07e2d5420c Move all Components sources into src/Components 2018-11-27 11:03:30 +00:00