Skip to content

Commit a0bd2c2

Browse files
authored
Merge branch 'main' into gurardrex/blazor-split-routing-and-navigaton
2 parents fb9c705 + 2187c92 commit a0bd2c2

File tree

142 files changed

+2493
-1917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+2493
-1917
lines changed

.github/copilot-instructions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
author: tdykstra
33
ms.author: wpickett
4-
ms.date: 09-21-2025
4+
ms.date: 10-16-2025
55
---
66

77
# Copilot Instructions for `dotnet/AspNetCore.Docs`
@@ -78,10 +78,14 @@ When working on an issue:
7878

7979
## Repository-Specific Guidelines
8080
- [ ] Follow the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/)
81+
- [ ] Use contractions following the guidance in [Use contractions](https://learn.microsoft.com/en-us/style-guide/word-choice/use-contractions)
8182
- [ ] **Repository Exceptions**:
8283
- [ ] Number ordered lists as "1." for every item (don't use sequential numbers)
8384
- [ ] Use backticks around content specifically for file names (`file.txt`), folders (`folder`), file paths (`folder/file.txt`), custom types (`myVariable`, `MyClass`), raw URLs in the text (`https://www.contoso.com`), URL segments (`/product/id/199`), file extensions (`.razor`), NuGet packages (`Microsoft.AspNetCore.SignalR.Client`), and code that should never be localized
8485
- [ ] For Blazor's Razor components mentioned in article text, use backticks around the name of the component (example: `Counter` component)
86+
- [ ] Use placeholders with braces in the format `{PLACEHOLDER NAME}` when used in URIs, code examples, and other contexts where placeholders are used. Use uppercase letters with spaces between words for the placeholder name inside the braces.
87+
- [ ] Wrong: "Launch the app and navigate to `https://localhost:<port>/openapi/v1.json` to view the generated OpenAPI document."
88+
- [ ] Correct: "Launch the app and navigate to `https://localhost:{PORT}/openapi/v1.json` to view the generated OpenAPI document, where the `{PORT}` placeholder is the port."
8589
- [ ] For any new or updated .md file, ensure the standard frontmatter (metadata) is included as specified in [Metadata for Microsoft Learn documentation.](https://learn.microsoft.com/en-us/contribute/content/metadata)
8690
- [ ] For any new or updated .md file added to the repository, ensure the following frontmatter (metadata) is included:
8791
- [ ] Metadata `ai-usage: ai-assisted` if any AI assistance was used

.github/workflows/blazor-hybrid-issue-processing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
issue_number: context.issue.number,
1818
owner: context.repo.owner,
1919
repo: context.repo.repo,
20-
body: `### 🏖️🌞 **_Summertime!! Woot!!_** 🏐⛵
20+
body: `### 🦃 ***Happy Thanksgiving!*** 🍽️
2121
22-
A green dinosaur 🦖 will be along shortly to assist. *Stand-by ........*`
22+
*Stand-by!* A green dinosaur 🦖 will be along shortly to assist.`
2323
})
2424
await github.rest.issues.addLabels({
2525
issue_number: context.issue.number,

.github/workflows/blazor-issue-processing.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
&& !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/hybrid'))
1010
|| contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-interop/index.md')
1111
|| contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-interop/wasm-browser-app.md')
12+
|| contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-on-webworkers.md')
1213
|| contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/views/tag-helpers/built-in/component-tag-helper.md')
1314
|| contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/views/tag-helpers/built-in/persist-component-state.md')
1415
runs-on: ubuntu-latest
@@ -22,9 +23,9 @@ jobs:
2223
issue_number: context.issue.number,
2324
owner: context.repo.owner,
2425
repo: context.repo.repo,
25-
body: `### 🏖️🌞 **_Summertime!! Woot!!_** 🏐⛵
26+
body: `### 🦃 ***Happy Thanksgiving!*** 🍽️
2627
27-
*Stand-by!* ... A green dinosaur 🦖 will be along shortly to assist.`
28+
*Stand-by!* A green dinosaur 🦖 will be along shortly to assist.`
2829
})
2930
await github.rest.issues.addLabels({
3031
issue_number: context.issue.number,

.openpublishing.publish.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626
],
2727
"notification_subscribers": [
28-
"riande@microsoft.com"
28+
"wpickett@microsoft.com"
2929
],
3030
"branches_to_filter": [],
3131
"git_repository_branch_open_to_public_contributors": "main",

.openpublishing.redirection.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,10 +1649,30 @@
16491649
"redirect_url": "/aspnet/core/fundamentals/error-handling-api",
16501650
"redirect_document_id": false
16511651
},
1652-
{
1652+
{
16531653
"source_path": "aspnetcore/fundamentals/map-static-files.md",
16541654
"redirect_url": "/aspnet/core/fundamentals/static-files",
16551655
"redirect_document_id": false
1656+
},
1657+
{
1658+
"source_path": "aspnetcore/migration/60-70.md",
1659+
"redirect_url": "/aspnet/core/migration/60-to-70",
1660+
"redirect_document_id": false
1661+
},
1662+
{
1663+
"source_path": "aspnetcore/migration/70-80.md",
1664+
"redirect_url": "/aspnet/core/migration/70-to-80",
1665+
"redirect_document_id": false
1666+
},
1667+
{
1668+
"source_path": "aspnetcore/migration/80-90.md",
1669+
"redirect_url": "/aspnet/core/migration/80-to-90",
1670+
"redirect_document_id": false
1671+
},
1672+
{
1673+
"source_path": "aspnetcore/migration/20_21.md",
1674+
"redirect_url": "/aspnet/core/migration/20-to-21",
1675+
"redirect_document_id": false
16561676
}
16571677
]
16581678
}

aspnetcore/blazor/call-web-api.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,24 @@ The solution includes a demonstration of obtaining weather data securely via an
358358
359359
## Disposal of `HttpRequestMessage`, `HttpResponseMessage`, and `HttpClient`
360360
361-
An <xref:System.Net.Http.HttpRequestMessage> without a body doesn't require explicit disposal with a [`using` declaration (C# 8 or later)](/dotnet/csharp/language-reference/proposals/csharp-8.0/using) or a [`using` block (all C# releases)](/dotnet/csharp/language-reference/keywords/using), but we recommend disposing with every use for the following reasons:
361+
An <xref:System.Net.Http.HttpRequestMessage> without a body doesn't require explicit disposal. However, you can dispose of it with either of the following patterns:
362+
363+
* `using` declaration (C# 8 or later):
364+
365+
```csharp
366+
using var request = new HttpRequestMessage(...);
367+
```
368+
369+
* [`using` block (all C# releases)](/dotnet/csharp/language-reference/keywords/using):
370+
371+
```csharp
372+
using (var request = new HttpRequestMessage(...))
373+
{
374+
...
375+
}
376+
```
377+
378+
We recommend disposing of every <xref:System.Net.Http.HttpRequestMessage> with every use for the following reasons:
362379
363380
* To gain a performance improvement by avoiding finalizers.
364381
* It hardens the code for the future in case a request body is ever added to an <xref:System.Net.Http.HttpRequestMessage> that didn't initially have one.
@@ -951,7 +968,7 @@ app.MapPatch("/todoitems/{id}", async (long id, TodoContext db) =>
951968
return TypedResults.Ok(todo);
952969
}
953970
954-
return TypedResults.NoContent();
971+
return TypedResults.NotFound();
955972
});
956973
```
957974

aspnetcore/blazor/components/data-binding.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about data binding features for Razor components and DOM elem
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
77
ms.custom: mvc, sfi-ropc-nochange
8-
ms.date: 11/12/2024
8+
ms.date: 10/30/2025
99
uid: blazor/components/data-binding
1010
---
1111
# ASP.NET Core Blazor data binding
@@ -230,6 +230,8 @@ The `:get` and `:set` modifiers are always used together.
230230

231231
With `:get`/`:set` binding, you can react to a value change before it's applied to the DOM, and you can change the applied value, if necessary. Whereas with `@bind:event="{EVENT}"` attribute binding, where the `{EVENT}` placeholder is a DOM event, you receive the notification after the DOM is updated, and there's no capacity to modify the applied value while binding.
232232

233+
The following `BindGetSet` component demonstrates `@bind:get`/`@bind:set` syntax for `<input>` elements and the [`InputText` component](xref:blazor/forms/input-components) used by [Blazor forms](xref:blazor/forms/index) in synchronous (`Set`) and asynchronous (`SetAsync`) scenarios.
234+
233235
`BindGetSet.razor`:
234236

235237
```razor
@@ -251,7 +253,7 @@ With `:get`/`:set` binding, you can react to a value change before it's applied
251253
<InputText @bind-Value:get="text" @bind-Value:set="SetAsync" />
252254
253255
@code {
254-
private string text = "";
256+
private string text = string.Empty;
255257
256258
private void Set(string value)
257259
{
@@ -958,6 +960,21 @@ In the following `NestedChild` component, the `NestedGrandchild` component:
958960

959961
Prior to the release of .NET 7, two-way binding across components uses `get`/`set` accessors with a third property that discards the <xref:System.Threading.Tasks.Task> returned by <xref:Microsoft.AspNetCore.Components.EventCallback.InvokeAsync%2A?displayProperty=nameWithType> in its setter. To see an example of this approach for .NET 6 or earlier before `@bind:get`/`@bind:set` modifiers became a framework feature, see [the `NestedChild` component of this section in the .NET 6 version of this article](?view=aspnetcore-6.0&preserve-view=true#bind-across-more-than-two-components).
960962

963+
The reason to avoid directly changing the value of a component parameter is that it effectively mutates the parent's state from the child component. This can interfere with Blazor's change detection process and trigger extra render cycles because parameters are meant to be *inputs*, they're not meant to be mutable state. In chained scenarios where data is passed among components, directly writing to a component parameter can lead to unintended effects, such as infinite rerenders that hang the app.
964+
965+
`@bind:get`/`@bind:set` syntax allows you to:
966+
967+
* Avoid creating an extra property that only exists to forward values and callbacks across chained components, which was required prior to the release of .NET 7.
968+
* Intercept and transform values before they're applied.
969+
* Keep the parameter immutable in the child, while still supporting two-way binding.
970+
971+
A useful analogy is [HTML's `<input>` element](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/input) that tracks the following value states:
972+
973+
* `defaultValue`: Like a component parameter received from the parent.
974+
* `value`: Like the current state inside the component.
975+
976+
If you mutate `defaultValue` directly, you're breaking the contract. Instead, these states are kept separate, and only the `value` is updated through controlled means after the initial render of the element. The same reasoning applies to component parameters, and using `@bind:get`/`@bind:set` syntax avoids potential unintended rendering effects associated with writing directly to component parameters.
977+
961978
:::moniker-end
962979

963980
`NestedChild.razor`:

aspnetcore/blazor/components/js-spa-frameworks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to create and use Razor components in JavaScript apps and
55
monikerRange: '>= aspnetcore-6.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 11/12/2024
8+
ms.date: 10/26/2025
99
uid: blazor/components/js-spa-frameworks
1010
---
1111
# Use Razor components in JavaScript apps and SPA frameworks
@@ -241,13 +241,13 @@ For an advanced example with additional features, see the example in the `BasicT
241241

242242
:::moniker range=">= aspnetcore-7.0"
243243

244-
Use Blazor custom elements to dynamically render Razor components from other SPA frameworks, such as Angular or React.
244+
Use Blazor custom elements to dynamically render Razor components from different JavaScript technologies, such as [Angular](https://angular.dev/), [React](https://react.dev/), and [Vue](https://vuejs.org/).
245245

246246
Blazor custom elements:
247247

248248
* Use standard HTML interfaces to implement custom HTML elements.
249249
* Eliminate the need to manually manage the state and lifecycle of root Razor components using JavaScript APIs.
250-
* Are useful for gradually introducing Razor components into existing projects written in other SPA frameworks.
250+
* Are useful for gradually introducing Razor components into existing projects written in other technologies.
251251

252252
Custom elements don't support [child content](xref:blazor/components/index#child-content-render-fragments) or [templated components](xref:blazor/components/templated-components).
253253

@@ -471,7 +471,7 @@ Use the custom element with any web framework. For example, the preceding counte
471471

472472
## Generate Angular and React components
473473

474-
Generate framework-specific JavaScript (JS) components from Razor components for web frameworks, such as Angular or React. This capability isn't included with .NET, but is enabled by the support for rendering Razor components from JS. The [JS component generation sample on GitHub](https://github.com/aspnet/samples/tree/main/samples/aspnetcore/blazor/JSComponentGeneration) demonstrates how to generate Angular and React components from Razor components. See the GitHub sample app's `README.md` file for additional information.
474+
Generate JavaScript (JS) components from Razor components for JavaScript technologies, such as Angular or React. This capability isn't included with .NET, but is enabled by the support for rendering Razor components from JS. The [JS component generation sample on GitHub](https://github.com/aspnet/samples/tree/main/samples/aspnetcore/blazor/JSComponentGeneration) demonstrates how to generate Angular and React components from Razor components. See the GitHub sample app's `README.md` file for additional information.
475475

476476
> [!WARNING]
477477
> The Angular and React component features are currently **experimental, unsupported, and subject to change or be removed at any time**. We welcome your feedback on how well this particular approach meets your requirements.

aspnetcore/blazor/components/layouts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to create reusable layout components for Blazor apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 11/12/2024
8+
ms.date: 10/30/2025
99
uid: blazor/components/layouts
1010
---
1111
# ASP.NET Core Blazor layouts
@@ -79,8 +79,8 @@ In an app created from a [Blazor project template](xref:blazor/project-structure
7979

8080
[Blazor's CSS isolation feature](xref:blazor/components/css-isolation) applies isolated CSS styles to the `MainLayout` component. By convention, the styles are provided by the accompanying stylesheet of the same name, `MainLayout.razor.css`. The ASP.NET Core framework implementation of the stylesheet is available for inspection in the ASP.NET Core reference source (`dotnet/aspnetcore` GitHub repository):
8181

82-
* [Blazor Web App `MainLayout.razor.css`](https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/MainLayout.razor.css)
83-
* [Blazor WebAssembly `MainLayout.razor.css`](https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Layout/MainLayout.razor.css)
82+
* Blazor Web App: Locate `MainLayout.razor.css` in the `Components/Layout` folder of the server project in the [project template](https://github.com/dotnet/aspnetcore/tree/main/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp).
83+
* [Blazor WebAssembly `MainLayout.razor.css`](https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Layout/MainLayout.razor.css).
8484

8585
[!INCLUDE[](~/includes/aspnetcore-repo-ref-source-links.md)]
8686

aspnetcore/blazor/components/quickgrid.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Set the `QuickGrid` component's <xref:Microsoft.AspNetCore.Components.QuickGrid.
127127
<QuickGrid Items="..." Pagination="pagination">
128128
```
129129

130-
<!-- UPDATE 10.0 Tracked by https://github.com/dotnet/aspnetcore/issues/57289
130+
<!-- UPDATE 11.0 Tracked by https://github.com/dotnet/aspnetcore/issues/57289
131131
for multiple paginator components problem. -->
132132

133133
To provide a UI for pagination, add a [`Paginator` component](xref:Microsoft.AspNetCore.Components.QuickGrid.Paginator) above or below the `QuickGrid` component. Set the <xref:Microsoft.AspNetCore.Components.QuickGrid.Paginator.State%2A?displayProperty=nameWithType> to `pagination`:

0 commit comments

Comments
 (0)