From a24183b7440c65639b8a1ae62a3888621de9ab26 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 08:39:54 -0500 Subject: [PATCH 01/12] Blazor What's New and Migration guidance --- aspnetcore/migration/60-70.md | 12 +- aspnetcore/release-notes/aspnetcore-7.0.md | 293 +++++++++++++++++++++ 2 files changed, 302 insertions(+), 3 deletions(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index e4b626dff0ff..a512ab1dcae2 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -71,16 +71,22 @@ In the project file, update each [Microsoft.AspNetCore.*](https://www.nuget.org/ ``` - + +### Migrate unmarshalled JavaScript interop + +Unmarshalled interop using the interface is obsolete and should be replaced with .NET JavaScript `[JSImport]`/`[JSExport]` interop. + +For more information, see . ## Update Docker images diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index b24e89566829..62499a18d5a3 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -209,6 +209,299 @@ SignalR hub methods now support injecting services through dependency injection Hub constructors can accept services from DI as parameters, which can be stored in properties on the class for use in a hub method. For more information, see [Inject services into a hub](xref:signalr/hubs?view=aspnetcore-7.0&preserve-view=true#inject-services-into-a-hub) +## Blazor + +### Handle location changing events + +Blazor in .NET 7 now has support for handling location changing events. This allows you to warn users about unsaved work or to perform related actions when the user performs a page navigation. + +For more information, see the following sections of the *Routing and navigation* article: + +* [Navigation options](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#navigation-options) +* [Handle/prevent location changes](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#handleprevent-location-changes) + +### Calling `InvokeAsync(StateHasChanged)` causes page to fallback to the default culture + +If a Razor component defines an event that's triggered from a background thread, the component might be required to capture and restore the execution context (`ExecutionContext`) at the time the handler is registered. + +For more information, see the following resources: + +* [Calling `InvokeAsync(StateHasChanged)` causes page to fallback to default culture (dotnet/aspnetcore #28521)](https://github.com/dotnet/aspnetcore/issues/28521) +* + +#26574 + +[28521](https://github.com/dotnet/aspnetcore/issues/28521) + +### Empty Blazor project templates + +Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without any extra demonstration code. These empty templates include only a basic home page, and we've also removed Bootstrap so that you can start with whatever CSS framework you prefer. + +For more information, see the following articles: + +* +* + +### Blazor custom elements no longer experimental + +The [`Microsoft.AspNetCore.Components.CustomElements`](https://www.nuget.org/packages/microsoft.aspnetcore.components.customelements) package for building [standards based custom elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements) is no longer experimental. + +For more information, see . + + + +### Bind get/set/after modifiers + +Provides ways of customizing how Blazor's @bind reads and writes a value + + + +For more information, see the following: + +* [`@bind:after="{EVENT}"` content at the end of the article's introductory guidance](xref:blazor/components/data-binding?view=aspnetcore-7.0) +* [*Bind across more than two components* section demonstrates the use of `@bind:get`/`@bind:set` syntax](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) + +Additional information: + +* [Design proposal: Bind get/set/after modifiers (dotnet/aspnetcore #39837)](https://github.com/dotnet/aspnetcore/issues/39837) +* [Support `@bind:get`, `@bind:set`, `@bind:after` (dotnet/razor-compiler #70)](https://github.com/dotnet/razor-compiler/pull/70) + +> [!WARNING] +> Final design changes prior to the general release might not be reflected in the initial design described by the product unit's GitHub issue and pull request. For the latest information on this feature, see the preceding cross-links to the ***official Blazor documentation***, which is kept updated with the latest guidance from the product unit. + + + + + +### Dynamic authentication requests with MSAL in Blazor WebAssembly + +Blazor provides out-of-the-box support for authentication using OpenID Connect and a variety of identity providers including Azure Active Directory (Azure AD) and Azure AD B2C. In .NET 7, Blazor WebAssembly supports creating dynamic authentication requests at runtime with custom parameters to handle advanced authentication scenarios. + +For more information, see the following articles: + +* +* + +### Blazor WebAssembly debugging improvements + +Blazor WebAssembly debugging has the following improvements: + +* Support for the **Just My Code** setting to show or hide type members not from user code. +* Support for inspecting multidimensional arrays. +* **Call Stack** now shows the correct name for async methods. +* Improved expression evaluation. +* Correct handling of the `new` keyword on derived members. +* Support for debugger related attributes in `System.Diagnostics`. + +### System.Security.Cryptography support on WebAssembly + +.NET 6 supported the SHA family of hashing algorithms when running on WebAssembly. .NET 7 enables more cryptographic algorithms by taking advantage of [:::no-loc text="SubtleCrypto":::](https://developer.mozilla.org/docs/Web/API/SubtleCrypto), when possible, and falling back to a .NET implementation when :::no-loc text="SubtleCrypto"::: can't be used. The following algorithms are supported on WebAssembly: + +* SHA1 +* SHA256 +* SHA384 +* SHA512 +* HMACSHA1 +* HMACSHA256 +* HMACSHA384 +* HMACSHA512 +* AES-CBC +* PBKDF2 +* HKDF + +For more information, see [Developers targeting browser-wasm can use Web Crypto APIs (dotnet/runtime #40074)](https://github.com/dotnet/runtime/issues/40074). + + + + + +### Inject services into custom validation attributes in Blazor + +Inject services into custom validation attributes. Blazor sets up the `ValidationContext` so that it can be used as a service provider. + +For more information, see . + +### Blazor WebAssembly default browser for debugging adopts Microsoft Edge + +In release versions prior to .NET 7, the default browser for debugging is Google Chrome. In .NET 7, the default browser for debugging is Microsoft Edge. + +### `Input*` components outside of an `EditContext`/`EditForm` + +The built-in input components are now supported outside of a form in Razor component markup. + +For more information, see . + +### Project template changes + +When .NET 6 was released last year, the HTML markup of the `_Host` page (`Pages/_Host.chstml`) was split between the `_Host` page and a new `_Layout` page (`Pages/_Layout.chstml`) in the .NET 6 Blazor Server project template. In .NET 7, the HTML markup has been moved back to the `_Host` page (`Pages/_Host.chstml`) in project templates. + +Several additional changes were made to the .NET 7 Blazor project templates. It isn't feasible to list every change to the templates in the documentation. To migrate an app to .NET 7 in order to adopt all of the changes, see . + +### Experimental `QuickGrid` component + +The new `QuickGrid` component provides a convenient data grid component for most common requirements and as a reference architecture and performance baseline for anyone building Blazor data grid components. + +For more information, see . + +Live demo: [QuickGrid for Blazor sample app](https://aspnet.github.io/quickgridsamples/) + + + +### Virtualization enhancements + +Virtualization enhancements in .NET 7: + +* The `Virtualize` component supports using the document itself as the scroll root, as an alternative to having some other element with `overflow-y: scroll`. +* If the `Virtualize` component is placed inside an element that requires a specific child tag name, `SpacerElement` allows you to obtain or set the virtualization spacer tag name. + +For more information, see the following sections of the *Virtualization* article: + +* [Root-level virtualization](xref:blazor/components/virtualization?view=aspnetcore-7.0#root-level-virtualization) +* [Control the spacer element tag name](xref:blazor/components/virtualization?view=aspnetcore-7.0#control-the-spacer-element-tag-name) + + + +### New Blazor loading page + +The Blazor WebAssembly project template has a new loading UI that shows the progress of loading the app. + +For more information, see . + +### Improved diagnostics for authentication in Blazor WebAssembly + +To help diagnose authentication issues in Blazor WebAssembly apps we added detailed logging that you can enable using the following logging configuration. + +For more information, see . + + + +### Conditional registration of the authentication state provider + +Prior to the release of .NET 7, `AuthenticationStateProvider` was registered with the DI container with `AddScoped`. This made it difficult to debug applications, as it forced a specific order of service registrations when providing a custom implementation. Due to internal framework changes, it's no longer necessary to register `AuthenticationStateProvider` with `AddScoped`: + +```diff +- builder.Services.AddScoped(); ++ builder.Services.TryAddScoped(); +``` + +### .NET WebAssembly build tools for .NET 6 projects + +You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new wasm-tools-net6 workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing wasm-tools workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 will need to use multi-targeting. + +For more information, see . + +## Blazor Hybrid + +### External URLs + +An explicit option has been added that permits opening external webpages in the browser. + +For more information, see . + +### Security + +New guidance is available for Blazor Hybrid security scenarios. For more information, see the following articles: + +* +* + ## Performance ### HTTP/2 Performance improvements From 5af88d09d33da3711b6489195e93e3e8a4109bfc Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 08:52:02 -0500 Subject: [PATCH 02/12] Updates --- aspnetcore/migration/60-70.md | 12 ++++++++++-- aspnetcore/release-notes/aspnetcore-7.0.md | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index a512ab1dcae2..fd442abecab1 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -75,19 +75,27 @@ In the project file, update each [Microsoft.AspNetCore.*](https://www.nuget.org/ ### Adopt .NET 7 features -After following the guidance earlier in this article to update an app to 7.0, adopt specific features by following the links in . +After following the guidance earlier in this article to update an app to 7.0, adopt specific features by following the links in . -To adopt all of the [new 7.0 features for Blazor apps](xref:aspnetcore-7.0#blazor), we recommend the following process: +To adopt all of the [new 7.0 features for Blazor apps](xref:aspnetcore-7#blazor), we recommend the following process: * Create a new 7.0 Blazor project from one of the Blazor project templates. For more information, see . * Move the app's components and code to the 7.0 app making modifications to adopt the new 7.0 features. + + ## Update Docker images For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. Use a base image that includes the ASP.NET Core 7.0 runtime. Consider the following `docker pull` command difference between ASP.NET Core 6.0 and 7.0: diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index 62499a18d5a3..b54c486be16c 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -378,7 +378,7 @@ https://github.com/dotnet/aspnetcore/issues/38479 Inject services into custom validation attributes. Blazor sets up the `ValidationContext` so that it can be used as a service provider. -For more information, see . +For more information, see . ### Blazor WebAssembly default browser for debugging adopts Microsoft Edge From 8386c193469a18fc0e5bec542e494470cf86fa37 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:49:16 -0500 Subject: [PATCH 03/12] Updates --- aspnetcore/migration/60-70.md | 2 +- aspnetcore/release-notes/aspnetcore-7.0.md | 86 ++++++++++++---------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index fd442abecab1..a5378abe9474 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -3,7 +3,7 @@ title: Migrate from ASP.NET Core 6.0 to 7.0 author: rick-anderson description: Learn how to migrate an ASP.NET Core 6 project to ASP.NET Core 7.0. ms.author: riande -ms.date: 09/26/2022 +ms.date: 10/14/2022 uid: migration/60-to-70 --- # Migrate from ASP.NET Core 6.0 to 7.0 diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index b54c486be16c..e0982c8deb50 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -4,7 +4,7 @@ author: rick-anderson description: Learn about the new features in ASP.NET Core 7.0. ms.author: riande ms.custom: mvc -ms.date: 08/19/2022 +ms.date: 10/14/2022 uid: aspnetcore-7 --- # What's new in ASP.NET Core 7.0 preview @@ -213,7 +213,7 @@ Hub constructors can accept services from DI as parameters, which can be stored ### Handle location changing events -Blazor in .NET 7 now has support for handling location changing events. This allows you to warn users about unsaved work or to perform related actions when the user performs a page navigation. +In .NET 7, Blazor supports location changing events. This allows you to warn users about unsaved work or to perform related actions when the user performs a page navigation. For more information, see the following sections of the *Routing and navigation* article: @@ -229,13 +229,9 @@ For more information, see the following resources: * [Calling `InvokeAsync(StateHasChanged)` causes page to fallback to default culture (dotnet/aspnetcore #28521)](https://github.com/dotnet/aspnetcore/issues/28521) * -#26574 - -[28521](https://github.com/dotnet/aspnetcore/issues/28521) - ### Empty Blazor project templates -Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without any extra demonstration code. These empty templates include only a basic home page, and we've also removed Bootstrap so that you can start with whatever CSS framework you prefer. +Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without demonstration code. These empty templates only include a basic home page, and we've removed Bootstrap so that you can start with a different CSS framework. For more information, see the following articles: @@ -260,18 +256,21 @@ For more information, see -For more information, see the following: +For more information, see the following content in the *Data binding* article: -* [`@bind:after="{EVENT}"` content at the end of the article's introductory guidance](xref:blazor/components/data-binding?view=aspnetcore-7.0) -* [*Bind across more than two components* section demonstrates the use of `@bind:get`/`@bind:set` syntax](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) +* [`@bind:after="{EVENT}"` content](xref:blazor/components/data-binding?view=aspnetcore-7.0) at the end of the article's introductory guidance. +* The [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) section demonstrates the use of `@bind:get`/`@bind:set` syntax. Additional information: @@ -279,13 +278,13 @@ Additional information: * [Support `@bind:get`, `@bind:set`, `@bind:after` (dotnet/razor-compiler #70)](https://github.com/dotnet/razor-compiler/pull/70) > [!WARNING] -> Final design changes prior to the general release might not be reflected in the initial design described by the product unit's GitHub issue and pull request. For the latest information on this feature, see the preceding cross-links to the ***official Blazor documentation***, which is kept updated with the latest guidance from the product unit. +> Final design changes prior to the general release might not be reflected in the initial design described by the product unit's GitHub issue and pull request. For the latest information on this feature, see the preceding cross-links to the official Blazor documentation. ### Dynamic authentication requests with MSAL in Blazor WebAssembly -Blazor provides out-of-the-box support for authentication using OpenID Connect and a variety of identity providers including Azure Active Directory (Azure AD) and Azure AD B2C. In .NET 7, Blazor WebAssembly supports creating dynamic authentication requests at runtime with custom parameters to handle advanced authentication scenarios. +New in .NET 7, Blazor WebAssembly supports creating dynamic authentication requests at runtime with custom parameters to handle advanced authentication scenarios. For more information, see the following articles: @@ -329,16 +330,16 @@ For more information, see the following articles: Blazor WebAssembly debugging has the following improvements: -* Support for the **Just My Code** setting to show or hide type members not from user code. +* Support for the **Just My Code** setting to show or hide type members that aren't from user code. * Support for inspecting multidimensional arrays. -* **Call Stack** now shows the correct name for async methods. +* **Call Stack** now shows the correct name for asynchronous methods. * Improved expression evaluation. * Correct handling of the `new` keyword on derived members. -* Support for debugger related attributes in `System.Diagnostics`. +* Support for debugger-related attributes in `System.Diagnostics`. -### System.Security.Cryptography support on WebAssembly +### `System.Security.Cryptography` support on WebAssembly -.NET 6 supported the SHA family of hashing algorithms when running on WebAssembly. .NET 7 enables more cryptographic algorithms by taking advantage of [:::no-loc text="SubtleCrypto":::](https://developer.mozilla.org/docs/Web/API/SubtleCrypto), when possible, and falling back to a .NET implementation when :::no-loc text="SubtleCrypto"::: can't be used. The following algorithms are supported on WebAssembly: +.NET 6 supported the SHA family of hashing algorithms when running on WebAssembly. .NET 7 enables more cryptographic algorithms by taking advantage of [:::no-loc text="SubtleCrypto":::](https://developer.mozilla.org/docs/Web/API/SubtleCrypto), when possible, and falling back to a .NET implementation when :::no-loc text="SubtleCrypto"::: can't be used. The following algorithms are supported on WebAssembly in .NET 7: * SHA1 * SHA256 @@ -356,6 +357,8 @@ For more information, see [Developers targeting browser-wasm can use Web Crypto -### Inject services into custom validation attributes in Blazor +### Inject services into custom validation attributes -Inject services into custom validation attributes. Blazor sets up the `ValidationContext` so that it can be used as a service provider. +You can now inject services into custom validation attributes. Blazor sets up the `ValidationContext` so that it can be used as a service provider. For more information, see . -### Blazor WebAssembly default browser for debugging adopts Microsoft Edge +### Blazor WebAssembly's default browser for debugging adopts Microsoft Edge In release versions prior to .NET 7, the default browser for debugging is Google Chrome. In .NET 7, the default browser for debugging is Microsoft Edge. @@ -392,9 +397,11 @@ For more information, see . +Several additional changes were made to the Blazor project templates. It isn't feasible to list every change to the templates in the documentation. To migrate an app to .NET 7 in order to adopt all of the changes, see . ### Experimental `QuickGrid` component @@ -420,7 +427,7 @@ https://github.com/dotnet/aspnetcore/pull/42534 Virtualization enhancements in .NET 7: -* The `Virtualize` component supports using the document itself as the scroll root, as an alternative to having some other element with `overflow-y: scroll`. +* The `Virtualize` component supports using the document itself as the scroll root, as an alternative to having some other element with `overflow-y: scroll` applied. * If the `Virtualize` component is placed inside an element that requires a specific child tag name, `SpacerElement` allows you to obtain or set the virtualization spacer tag name. For more information, see the following sections of the *Virtualization* article: @@ -434,7 +441,7 @@ For more information, see the following sections of the *Virtualization* article This is covered via the existing ref source link in the article. I don't think we need to remark on it in the article, but you may wish to say something here. - I'll float some draft language here. + I'll float some draft language. ### `MouseEventArgs` updates @@ -452,7 +459,7 @@ For more information, see . @@ -464,7 +471,10 @@ For more information, see . +For more information, see the following articles: + +* : Pertains only to Blazor WebAssebmly apps. +* : Pertains only to JavaScript apps that don't depend on the Blazor UI component model. Under consideration for docs ... @@ -474,7 +484,7 @@ Under consideration for docs ... ### Conditional registration of the authentication state provider -Prior to the release of .NET 7, `AuthenticationStateProvider` was registered with the DI container with `AddScoped`. This made it difficult to debug applications, as it forced a specific order of service registrations when providing a custom implementation. Due to internal framework changes, it's no longer necessary to register `AuthenticationStateProvider` with `AddScoped`: +Prior to the release of .NET 7, `AuthenticationStateProvider` was registered in the service container with `AddScoped`. This made it difficult to debug apps, as it forced a specific order of service registrations when providing a custom implementation. Due to internal framework changes over time, it's no longer necessary to register `AuthenticationStateProvider` with `AddScoped`: ```diff - builder.Services.AddScoped(); @@ -483,7 +493,7 @@ Prior to the release of .NET 7, `AuthenticationStateProvider` was registered wit ### .NET WebAssembly build tools for .NET 6 projects -You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new wasm-tools-net6 workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing wasm-tools workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 will need to use multi-targeting. +You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new `wasm-tools-net6` workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing `wasm-tools` workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 must use multi-targeting. For more information, see . @@ -491,7 +501,7 @@ For more information, see . From eb7c093ada35a6c9a04ba622e6c5ac512ce50a50 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:59:40 -0500 Subject: [PATCH 04/12] Updates --- aspnetcore/migration/60-70.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index a5378abe9474..0ab8da8eb82e 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -84,7 +84,7 @@ To adopt all of the [new 7.0 features for Blazor apps](xref:aspnetcore-7#blazor) +### .NET WebAssembly build tools for .NET 6 projects + +You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new `wasm-tools-net6` workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing `wasm-tools` workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 must use multi-targeting. + +New features in the `wasm-tools` workload for .NET 7 that help improve performance: + +* WebAssembly SIMD support (should only be used with AOT, not supported by Apple Safari): `WasmEnableSIMD` +* WebAssembly exception handling support: `WasmEnableExceptionHandling` + +For more information, see . + ## Update Docker images For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. Use a base image that includes the ASP.NET Core 7.0 runtime. Consider the following `docker pull` command difference between ASP.NET Core 6.0 and 7.0: diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index fcb3f6eec15e..1386b3ab045b 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -220,15 +220,6 @@ For more information, see the following sections of the *Routing and navigation* * [Navigation options](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#navigation-options) * [Handle/prevent location changes](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#handleprevent-location-changes) -### Calling `InvokeAsync(StateHasChanged)` causes page to fallback to the default culture - -If a Razor component defines an event that's triggered from a background thread, the component might be required to capture and restore the execution context (`ExecutionContext`) at the time the handler is registered. - -For more information, see the following resources: - -* [Calling `InvokeAsync(StateHasChanged)` causes page to fallback to default culture (dotnet/aspnetcore #28521)](https://github.com/dotnet/aspnetcore/issues/28521) -* - ### Empty Blazor project templates Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without demonstration code. These empty templates only include a basic home page, and we've removed Bootstrap so that you can start with a different CSS framework. @@ -280,42 +271,18 @@ Additional information: > [!WARNING] > Final design changes prior to the general release might not be reflected in the initial design described by the product unit's GitHub issue and pull request. For the latest information on this feature, see the preceding cross-links to the official Blazor documentation. - - - +* Components reset their parameters to their default values when a value is removed. +* Blazor WebAssembly: + * Add new types. + * Add nested classes. + * Add static and instance methods to existing types. + * Add static fields and methods to existing types. + * Add static lambdas to existing methods. + * Add lambdas that capture `this` to existing methods that already captured `this` previously. ### Dynamic authentication requests with MSAL in Blazor WebAssembly @@ -385,10 +352,6 @@ You can now inject services into custom validation attributes. Blazor sets up th For more information, see . -### Blazor WebAssembly's default browser for debugging adopts Microsoft Edge - -In release versions prior to .NET 7, the default browser for debugging is Google Chrome. In .NET 7, the default browser for debugging is Microsoft Edge. - ### `Input*` components outside of an `EditContext`/`EditForm` The built-in input components are now supported outside of a form in Razor component markup. @@ -491,12 +454,6 @@ Prior to the release of .NET 7, `AuthenticationStateProvider` was registered in + builder.Services.TryAddScoped(); ``` -### .NET WebAssembly build tools for .NET 6 projects - -You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new `wasm-tools-net6` workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing `wasm-tools` workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 must use multi-targeting. - -For more information, see . - ## Blazor Hybrid ### External URLs From c4ae886debec54bf30ccf6d439aad95d175485e7 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:36:19 -0500 Subject: [PATCH 07/12] Updates --- aspnetcore/migration/60-70.md | 2 + aspnetcore/release-notes/aspnetcore-7.0.md | 68 +--------------------- 2 files changed, 4 insertions(+), 66 deletions(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index ef55b261bb85..3874fa99a54b 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -100,6 +100,8 @@ For more information, see . You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new `wasm-tools-net6` workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing `wasm-tools` workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 must use multi-targeting. +### Improvements to the .NET WebAssembly build tools + New features in the `wasm-tools` workload for .NET 7 that help improve performance: * WebAssembly SIMD support (should only be used with AOT, not supported by Apple Safari): `WasmEnableSIMD` diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index 1386b3ab045b..074ff3189d16 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -211,9 +211,9 @@ Hub constructors can accept services from DI as parameters, which can be stored ## Blazor -### Handle location changing events +### Handle location changing events and navigation state -In .NET 7, Blazor supports location changing events. This allows you to warn users about unsaved work or to perform related actions when the user performs a page navigation. +In .NET 7, Blazor supports location changing events and maintaining navigation state. This allows you to warn users about unsaved work or to perform related actions when the user performs a page navigation. For more information, see the following sections of the *Routing and navigation* article: @@ -235,16 +235,6 @@ The [`Microsoft.AspNetCore.Components.CustomElements`](https://www.nuget.org/pac For more information, see . - - ### Bind get/set/after modifiers New modifiers, `@bind:get`/`@bind:set`/`@bind:after`, allow you to customize how Blazor's `@bind` attribute directive reads and writes bound values. @@ -263,14 +253,6 @@ For more information, see the following content in the *Data binding* article: * [`@bind:after="{EVENT}"` content](xref:blazor/components/data-binding?view=aspnetcore-7.0) at the end of the article's introductory guidance. * The [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) section demonstrates the use of `@bind:get`/`@bind:set` syntax. -Additional information: - -* [Design proposal: Bind get/set/after modifiers (dotnet/aspnetcore #39837)](https://github.com/dotnet/aspnetcore/issues/39837) -* [Support `@bind:get`, `@bind:set`, `@bind:after` (dotnet/razor-compiler #70)](https://github.com/dotnet/razor-compiler/pull/70) - -> [!WARNING] -> Final design changes prior to the general release might not be reflected in the initial design described by the product unit's GitHub issue and pull request. For the latest information on this feature, see the preceding cross-links to the official Blazor documentation. - ### Hot Reload improvements In .NET 7, Hot Reload support includes the following: @@ -322,30 +304,6 @@ Blazor WebAssembly debugging has the following improvements: For more information, see [Developers targeting browser-wasm can use Web Crypto APIs (dotnet/runtime #40074)](https://github.com/dotnet/runtime/issues/40074). - - - - ### Inject services into custom validation attributes You can now inject services into custom validation attributes. Blazor sets up the `ValidationContext` so that it can be used as a service provider. @@ -374,18 +332,6 @@ For more information, see - ### Virtualization enhancements Virtualization enhancements in .NET 7: @@ -398,22 +344,12 @@ For more information, see the following sections of the *Virtualization* article * [Root-level virtualization](xref:blazor/components/virtualization?view=aspnetcore-7.0#root-level-virtualization) * [Control the spacer element tag name](xref:blazor/components/virtualization?view=aspnetcore-7.0#control-the-spacer-element-tag-name) - - ### New Blazor loading page The Blazor WebAssembly project template has a new loading UI that shows the progress of loading the app. From 6a70b24235ba6ee78f2ca5b44bdc3db60d1193e5 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 14 Oct 2022 18:12:39 -0500 Subject: [PATCH 08/12] Updates --- aspnetcore/migration/60-70.md | 9 --------- aspnetcore/release-notes/aspnetcore-7.0.md | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index 3874fa99a54b..e9c0e4b495f0 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -100,15 +100,6 @@ For more information, see . You can now use the .NET WebAssembly build tools with a .NET 6 project when working with the .NET 7 SDK. The new `wasm-tools-net6` workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET 7 SDK. The existing `wasm-tools` workload installs the .NET WebAssembly build tools for .NET 7 projects. However, the .NET 7 version of the .NET WebAssembly build tools are incompatible with existing projects built with .NET 6. Projects using the .NET WebAssembly build tools that need to support both .NET 6 and .NET 7 must use multi-targeting. -### Improvements to the .NET WebAssembly build tools - -New features in the `wasm-tools` workload for .NET 7 that help improve performance: - -* WebAssembly SIMD support (should only be used with AOT, not supported by Apple Safari): `WasmEnableSIMD` -* WebAssembly exception handling support: `WasmEnableExceptionHandling` - -For more information, see . - ## Update Docker images For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. Use a base image that includes the ASP.NET Core 7.0 runtime. Consider the following `docker pull` command difference between ASP.NET Core 6.0 and 7.0: diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index 074ff3189d16..c0aa692cd2c5 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -383,13 +383,26 @@ Under consideration for docs ... ### Conditional registration of the authentication state provider -Prior to the release of .NET 7, `AuthenticationStateProvider` was registered in the service container with `AddScoped`. This made it difficult to debug apps, as it forced a specific order of service registrations when providing a custom implementation. Due to internal framework changes over time, it's no longer necessary to register `AuthenticationStateProvider` with `AddScoped`: +Prior to the release of .NET 7, `AuthenticationStateProvider` was registered in the service container with `AddScoped`. This made it difficult to debug apps, as it forced a specific order of service registrations when providing a custom implementation. Due to internal framework changes over time, it's no longer necessary to register `AuthenticationStateProvider` with `AddScoped`. + +In developer code, make the following change to the authentication state provider service registration: ```diff - builder.Services.AddScoped(); + builder.Services.TryAddScoped(); ``` +In the preceding example, `ExternalAuthStateProvider` is the developer's service implementation. + +### Improvements to the .NET WebAssembly build tools + +New features in the `wasm-tools` workload for .NET 7 that help improve performance: + +* WebAssembly SIMD support (should only be used with AOT, not supported by Apple Safari): `WasmEnableSIMD` +* WebAssembly exception handling support: `WasmEnableExceptionHandling` + +For more information, see . + ## Blazor Hybrid ### External URLs From 6a1ebde4173c19b896a1535ea0085de04580c76e Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Sat, 15 Oct 2022 06:33:11 -0500 Subject: [PATCH 09/12] Update aspnetcore/release-notes/aspnetcore-7.0.md Co-authored-by: Artak <34246760+mkArtakMSFT@users.noreply.github.com> --- aspnetcore/release-notes/aspnetcore-7.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index c0aa692cd2c5..b93a7ade5adb 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -222,7 +222,7 @@ For more information, see the following sections of the *Routing and navigation* ### Empty Blazor project templates -Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without demonstration code. These empty templates only include a basic home page, and we've removed Bootstrap so that you can start with a different CSS framework. +Blazor has two new project templates for starting from a blank slate. The new **Blazor Server App Empty** and **Blazor WebAssembly App Empty** project templates are just like their non-empty counterparts but without example code. These empty templates only include a basic home page, and we've removed Bootstrap so that you can start with a different CSS framework. For more information, see the following articles: From 5cf6effc0cf7c29e5a3934471521fbef0445e47b Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Sat, 15 Oct 2022 06:34:12 -0500 Subject: [PATCH 10/12] Updates --- aspnetcore/release-notes/aspnetcore-7.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index b93a7ade5adb..6926232601cb 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -231,7 +231,7 @@ For more information, see the following articles: ### Blazor custom elements -The [`Microsoft.AspNetCore.Components.CustomElements`](https://www.nuget.org/packages/microsoft.aspnetcore.components.customelements) package enables building [standards based custom elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements) using Blazor. +The [`Microsoft.AspNetCore.Components.CustomElements`](https://www.nuget.org/packages/microsoft.aspnetcore.components.customelements) package enables building [standards based custom DOM elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements) using Blazor. For more information, see . From 9d7ef3cb8720339ad90ba21f9c28162afdfb1bd8 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 17 Oct 2022 04:36:49 -0500 Subject: [PATCH 11/12] Updates --- aspnetcore/blazor/components/data-binding.md | 23 ++++++++++ aspnetcore/migration/60-70.md | 32 ++++++++++++++ aspnetcore/release-notes/aspnetcore-7.0.md | 45 +++++++++++++++----- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/aspnetcore/blazor/components/data-binding.md b/aspnetcore/blazor/components/data-binding.md index 176ec63ad617..e6becc6a9aad 100644 --- a/aspnetcore/blazor/components/data-binding.md +++ b/aspnetcore/blazor/components/data-binding.md @@ -719,6 +719,29 @@ In the following example: } ``` +Components support two-way data binding by defining a pair of parameters: + +* `@bind:get`: Specifies the value to bind. +* `@bind:set`: Specifies a callback for when the value changes. + +The `@bind:get` and `@bind:set` modifiers are always used together. + +Example: + +```razor + + +@code { + [Parameter] + public string? Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } +} +``` + +For another example use of `@bind:get` and `@bind:set`, see the [Bind across more than two components](#bind-across-more-than-two-components) section later in this article. + Razor attribute binding is case sensitive: * `@bind`, `@bind:event`, and `@bind:after` are valid. diff --git a/aspnetcore/migration/60-70.md b/aspnetcore/migration/60-70.md index e9c0e4b495f0..7f2cbf7a4fbf 100644 --- a/aspnetcore/migration/60-70.md +++ b/aspnetcore/migration/60-70.md @@ -82,6 +82,38 @@ To adopt all of the [new 7.0 features for Blazor apps](xref:aspnetcore-7#blazor) * Create a new 7.0 Blazor project from one of the Blazor project templates. For more information, see . * Move the app's components and code to the 7.0 app making modifications to adopt the new 7.0 features. +### Simplify component parameter binding + +In prior Blazor releases, binding across multiple components required binding to properties with `get`/`set` accessors. + +In .NET 6 and earlier: + +```razor + + +@code { + ... + + private string BoundValue + { + get => ChildMessage ?? string.Empty; + set => ChildMessageChanged.InvokeAsync(value); + } +} +``` + +In .NET 7, you can use the new `@bind:get` and `@bind:set` modifiers to support two-way data binding and simplify the binding syntax: + +```razor + +``` + +For more information, see the following content in the *Data binding* article: + +* [Introduction](xref:blazor/components/data-binding?view=aspnetcore-7.0) +* [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) + + private async Task PerformSearch() + { + ... + } +} +``` + +In .NET 7, it's also easier to set up binding for component parameters. Components can support two-way data binding by defining a pair of parameters: + +* `@bind:get`: Specifies the value to bind. +* `@bind:set`: Specifies a callback for when the value changes. + +The `@bind:get` and `@bind:set` modifiers are always used together. + +Example: + +```razor + + +@code { + [Parameter] + public TValue? Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } +} +``` For more information, see the following content in the *Data binding* article: -* [`@bind:after="{EVENT}"` content](xref:blazor/components/data-binding?view=aspnetcore-7.0) at the end of the article's introductory guidance. -* The [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) section demonstrates the use of `@bind:get`/`@bind:set` syntax. +* [Introduction](xref:blazor/components/data-binding?view=aspnetcore-7.0) +* [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components) ### Hot Reload improvements From 6c162a6b27c2242954481cba2bdc7cae896fb0de Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 17 Oct 2022 05:00:46 -0500 Subject: [PATCH 12/12] Updates --- aspnetcore/release-notes/aspnetcore-7.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index acab5779e465..ae67852028e9 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -421,10 +421,10 @@ In the preceding example, `ExternalAuthStateProvider` is the developer's service ### Improvements to the .NET WebAssembly build tools -New features in the `wasm-tools` workload for .NET 7 that help improve performance: +New features in the `wasm-tools` workload for .NET 7 that help improve performance and handle exceptions: -* WebAssembly SIMD support (should only be used with AOT, not supported by Apple Safari): `WasmEnableSIMD` -* WebAssembly exception handling support: `WasmEnableExceptionHandling` +* [WebAssembly Single Instruction, Multiple Data (SIMD)](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md) support (only with AOT, not supported by Apple Safari) +* WebAssembly exception handling support For more information, see .