Skip to content

Commit 9559ea0

Browse files
authored
Merge pull request #35458 from dotnet/main
2 parents 06c3011 + 95e0dcf commit 9559ea0

File tree

7 files changed

+185
-45
lines changed

7 files changed

+185
-45
lines changed

aspnetcore/blazor/components/quickgrid.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ In the following example:
228228

229229
### Close `QuickGrid` column options
230230

231-
Close the `QuickGrid` column options UI with the `CloseColumnOptionsAsync` method.
231+
Close the `QuickGrid` column options UI with the `HideColumnOptionsAsync` method.
232232

233233
The following example closes the column options UI as soon as the title filter is applied:
234234

@@ -237,7 +237,7 @@ The following example closes the column options UI as soon as the title filter i
237237
<PropertyColumn Property="@(m => m.Title)" Title="Title">
238238
<ColumnOptions>
239239
<input type="search" @bind="titleFilter" placeholder="Filter by title"
240-
@bind:after="@(() => movieGrid.CloseColumnOptionsAsync())" />
240+
@bind:after="@(() => movieGrid.HideColumnOptionsAsync())" />
241241
</ColumnOptions>
242242
</PropertyColumn>
243243
<PropertyColumn Property="@(m => m.Genre)" Title="Genre" />

aspnetcore/blazor/fundamentals/routing.md

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,25 @@ Slashes and segments of the captured path are decoded. For a route template of `
571571

572572
Use <xref:Microsoft.AspNetCore.Components.NavigationManager> to manage URIs and navigation in C# code. <xref:Microsoft.AspNetCore.Components.NavigationManager> provides the event and methods shown in the following table.
573573

574-
:::moniker range=">= aspnetcore-8.0"
574+
:::moniker range=">= aspnetcore-10.0"
575+
576+
<!-- UPDATE 10.0 - API doc cross-links -->
577+
578+
Member | Description
579+
--- | ---
580+
<xref:Microsoft.AspNetCore.Components.NavigationManager.Uri> | Gets the current absolute URI.
581+
<xref:Microsoft.AspNetCore.Components.NavigationManager.BaseUri> | Gets the base URI (with a trailing slash) that can be prepended to relative URI paths to produce an absolute URI. Typically, <xref:Microsoft.AspNetCore.Components.NavigationManager.BaseUri> corresponds to the `href` attribute on the document's `<base>` element ([location of `<head>` content](xref:blazor/project-structure#location-of-head-and-body-content)).
582+
<xref:Microsoft.AspNetCore.Components.NavigationManager.NavigateTo%2A> | Navigates to the specified URI. If `forceLoad` is `false`:<ul><li>And enhanced navigation is available at the current URL, Blazor's enhanced navigation is activated.</li><li>Otherwise, Blazor performs a full-page reload for the requested URL.</li></ul>If `forceLoad` is `true`:<ul><li>Client-side routing is bypassed.</li><li>The browser is forced to load the new page from the server, whether or not the URI is normally handled by the client-side interactive router.</li></ul><p>For more information, see the [Enhanced navigation and form handling](#enhanced-navigation-and-form-handling) section.</p><p>If `replace` is `true`, the current URI in the browser history is replaced instead of pushing a new URI onto the history stack.</p>
583+
<xref:Microsoft.AspNetCore.Components.NavigationManager.LocationChanged> | An event that fires when the navigation location has changed. For more information, see the [Location changes](#location-changes) section.
584+
`NotFound` | Called to handle scenarios where a requested resource isn't found. For more information, see the [Not Found responses](#not-found-responses) section.
585+
<xref:Microsoft.AspNetCore.Components.NavigationManager.ToAbsoluteUri%2A> | Converts a relative URI into an absolute URI.
586+
<xref:Microsoft.AspNetCore.Components.NavigationManager.ToBaseRelativePath%2A> | Based on the app's base URI, converts an absolute URI into a URI relative to the base URI prefix. For an example, see the [Produce a URI relative to the base URI prefix](#produce-a-uri-relative-to-the-base-uri-prefix) section.
587+
[`RegisterLocationChangingHandler`](#handleprevent-location-changes) | Registers a handler to process incoming navigation events. Calling <xref:Microsoft.AspNetCore.Components.NavigationManager.NavigateTo%2A> always invokes the handler.
588+
<xref:Microsoft.AspNetCore.Components.NavigationManagerExtensions.GetUriWithQueryParameter%2A> | Returns a URI constructed by updating <xref:Microsoft.AspNetCore.Components.NavigationManager.Uri?displayProperty=nameWithType> with a single parameter added, updated, or removed. For more information, see the [Query strings](#query-strings) section.
589+
590+
:::moniker-end
591+
592+
:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0"
575593

576594
Member | Description
577595
--- | ---
@@ -684,6 +702,113 @@ The following component:
684702

685703
For more information on component disposal, see <xref:blazor/components/component-disposal>.
686704

705+
:::moniker range=">= aspnetcore-10.0"
706+
707+
## Not Found responses
708+
709+
<!-- UPDATE 10.0 - API doc cross-links -->
710+
711+
*In ASP.NET Core 10.0 Preview 4, Not Found responses are only available for static SSR and global interactive rendering. Per-page/component rendering support is planned for Preview 5 in June, 2025.*
712+
713+
<xref:Microsoft.AspNetCore.Components.NavigationManager> provides a `NotFound` method to handle scenarios where a requested resource isn't found during static server-side rendering (static SSR) or global interactive rendering:
714+
715+
* **Static SSR**: Calling `NotFound` sets the HTTP status code to 404.
716+
* **Streaming rendering**: Throws an exception if the response has already started.
717+
* **Interactive rendering**: Signals the Blazor router ([`Router` component](xref:blazor/fundamentals/routing#route-templates)) to render Not Found content.
718+
719+
When a component is rendered statically (static SSR) and `NavigationManager.NotFound` is called, the 404 status code is set on the response:
720+
721+
```razor
722+
@page "/render-not-found-ssr"
723+
@inject NavigationManager Navigation
724+
725+
@code {
726+
protected override void OnInitialized()
727+
{
728+
Navigation.NotFound();
729+
}
730+
}
731+
```
732+
733+
Two approaches for providing Not Found content for global interactive rendering:
734+
735+
* Use a Not Found page (Razor component).
736+
* Specify Not Found content in the [`Router` component's](xref:blazor/fundamentals/routing#route-templates) <xref:Microsoft.AspNetCore.Components.Routing.Router.NotFound%2A> property (`<NotFound>...</NotFound>` markup or by setting the `NotFound` parameter to a render fragment in C# code).
737+
738+
The following example uses a Not Found page (`NotFoundPage` component) to render Not Found content.
739+
740+
`NotFoundPage.razor`:
741+
742+
```razor
743+
<h1>Not Found</h1>
744+
745+
<p>Sorry! Nothing to show.</p>
746+
```
747+
748+
Specify the `NotFoundPage` component to the `Router` component in `Routes.razor`. You might need to specify the component's namespace with an [`@using`](xref:mvc/views/razor#using) directive either at the top of the `Routes.razor` file or in an [`_Imports.razor` file](xref:blazor/components/index#component-name-class-name-and-namespace).
749+
750+
```razor
751+
<Router ...>
752+
<Found ...>
753+
...
754+
</Found>
755+
<NotFound>
756+
<NotFoundPage />
757+
</NotFound>
758+
</Router>
759+
```
760+
761+
When a component is rendered with a global interactive render mode, calling `NotFound` signals the Blazor router to render Not Found content, which is the `NotFoundPage` component:
762+
763+
```razor
764+
@page "/render-not-found-interactive"
765+
@inject NavigationManager Navigation
766+
767+
@if (RendererInfo.IsInteractive)
768+
{
769+
<button @onclick="TriggerNotFound">Trigger Not Found</button>
770+
}
771+
772+
@code {
773+
private void TriggerNotFound()
774+
{
775+
Navigation.NotFound();
776+
}
777+
}
778+
```
779+
780+
You can use the `OnNotFound` event for notifications when `NotFound` is invoked. The following example uses a render fragment (<xref:Microsoft.AspNetCore.Components.RenderFragment>) to render the Not Found content.
781+
782+
`Routes.razor`:
783+
784+
```razor
785+
@inject NavigationManager Navigation
786+
@inject ILogger<Routes> Logger
787+
788+
<Router AppAssembly="typeof(Program).Assembly" NotFound="renderFragment">
789+
<Found Context="routeData">
790+
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
791+
<FocusOnNavigate RouteData="routeData" Selector="h1" />
792+
</Found>
793+
</Router>
794+
795+
@code {
796+
private RenderFragment renderFragment =
797+
@<div><h1>Not Found</h1><p>Sorry! Nothing to show.</p></div>;
798+
799+
protected override void OnInitialized() => Navigation.OnNotFound += OnNotFound;
800+
801+
private void OnNotFound(object? sender, EventArgs args)
802+
{
803+
Logger.LogError("Something wasn't found!");
804+
}
805+
806+
public void Dispose() => Navigation.OnNotFound -= OnNotFound;
807+
}
808+
```
809+
810+
:::moniker-end
811+
687812
:::moniker range=">= aspnetcore-8.0"
688813

689814
## Enhanced navigation and form handling

aspnetcore/blazor/fundamentals/static-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ The following configuration must be present in the `wwwwoot/index.html` file of
254254
</html>
255255
```
256256

257-
In the project file (`.csproj`), the `<WriteImportMapToHtml>` property is set to `true`:
257+
In the project file (`.csproj`), the `<OverrideHtmlAssetPlaceholders>` property is set to `true`:
258258

259259
```xml
260260
<PropertyGroup>
261-
<WriteImportMapToHtml>true</WriteImportMapToHtml>
261+
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
262262
</PropertyGroup>
263263
```
264264

aspnetcore/blazor/performance/webassembly-browser-developer-tools-diagnostics.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about browser developer tools diagnostics in ASP.NET Core Bla
55
monikerRange: '>= aspnetcore-10.0'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 05/02/2025
8+
ms.date: 05/13/2025
99
uid: blazor/performance/webassembly-browser-developer-tools
1010
---
1111
# ASP.NET Core Blazor WebAssembly browser developer tools diagnostics
@@ -40,10 +40,12 @@ The MSBuild properties in the following table enable profiler integration.
4040
Property | Default | Set value to&hellip; | Description
4141
--- | :---: | :---: | ---
4242
`<WasmProfilers>` | No value | `browser` | Mono profilers to use. Potential values are "`browser`" and "`log`". To use both, separate the values with a semicolon. The `browser` profiler enables integration with the browser's developer tools profiler.
43-
`<WasmNativeStrip>` | `true` | `false` | Controls stripping the native executable.
44-
`<WasmNativeDebugSymbols>` | `true` | `true` | Controls building with native debug symbols.
43+
`<WasmNativeStrip>` | `true` | `false` | Enables stripping the native executable.
44+
`<WasmNativeDebugSymbols>` | `true` | `true` | Enables building with native debug symbols.
4545

46-
Enabling profilers has negative size and performance impact, so don't publish an app for production with profilers enabled. In the following example, a condition is set on a property group section that only enables profiling when the app is built with `/p:BlazorSampleProfilingEnabled=true` (.NET CLI) or `<BlazorSampleProfilingEnabled>true</BlazorSampleProfilingEnabled>` in a Visual Studio publish profile, where "`BlazorSampleProfilingEnabled`" is a custom symbol name that you choose and doesn't conflict with other symbol names.
46+
Setting the [`Timing-Allow-Origin` HTTP header](https://developer.mozilla.org/docs/Web/HTTP/Reference/Headers/Timing-Allow-Origin) allows for more precise time measurements.
47+
48+
Enabling profilers has negative size and performance impacts, so don't publish an app for production with profilers enabled. In the following example, a condition is set on a property group section that only enables profiling when the app is built with `/p:BlazorSampleProfilingEnabled=true` (.NET CLI) or `<BlazorSampleProfilingEnabled>true</BlazorSampleProfilingEnabled>` in a Visual Studio publish profile, where "`BlazorSampleProfilingEnabled`" is a custom symbol name that you choose and doesn't conflict with other symbol names.
4749

4850
In the app's project file (`.csproj`):
4951

@@ -61,9 +63,9 @@ Alternatively, enable features when the app is built with the .NET CLI. The foll
6163
/p:WasmProfilers=browser /p:WasmNativeStrip=false /p:WasmNativeDebugSymbols=true
6264
```
6365

64-
Setting WebAssembly profilers with `<WasmProfilers>browser;</WasmProfilers>` doesn't require AOT.
66+
Setting WebAssembly profilers with `<WasmProfilers>` doesn't require [ahead-of-time (AOT) compilation](xref:blazor/tooling/webassembly).
6567

66-
The browser developer tools profiler can be used with AOT (`<RunAOTCompilation>`/`<RunAOTCompilationAfterBuild>` set to `true`) and without WebAssembly profilers (`<WasmProfilers>browser;</WasmProfilers>` removed from the preceding property group).
68+
The browser developer tools profiler can be used with AOT (`<RunAOTCompilation>`/`<RunAOTCompilationAfterBuild>` set to `true`) and without WebAssembly profilers (`<WasmProfilers>` removed).
6769

6870
To see AOT method names in the developer tools console, install [DWARF chrome extension](https://chromewebstore.google.com/detail/cc++-devtools-support-dwa/pdcpmagijalfljmkmjngeonclgbbannb).
6971

@@ -92,7 +94,6 @@ Permissiable `{FILTER}` placeholder values are shown in the following table.
9294
Filter | Description
9395
--- | ---
9496
`all` | All assemblies
95-
`none` | No assemblies
9697
`program` | Entry point assembly
9798
`{ASSEMBLY}` | Specifies an assembly (`{ASSEMBLY}`)
9899
`M:Type:{METHOD}` | Specifies a method (`{METHOD}`)
@@ -107,18 +108,6 @@ In the following example, profiled methods are filtered to the app's namespace,
107108
<WasmProfilers>browser:callspec=N:{APP NAMESPACE};</WasmProfilers>
108109
```
109110

110-
## .NET Core Diagnostics Client Library example
111-
112-
In the project file (`.csproj`), use the `<WasmProfilers>` property set to `browser` to enable integration with the Mono profiler. Currently, only "`browser`" is supported. The `browser` profiler enables integration with the browser's developer tools profiler.
113-
114-
```xml
115-
<PropertyGroup>
116-
<WasmProfilers>browser</WasmProfilers>
117-
</PropertyGroup>
118-
```
119-
120-
The [`Timing-Allow-Origin` HTTP header](https://developer.mozilla.org/docs/Web/HTTP/Reference/Headers/Timing-Allow-Origin) allows for more precise time measurements.
121-
122111
## Additional resources
123112

124113
* [What diagnostic tools are available in .NET Core?](/dotnet/core/diagnostics/)

aspnetcore/blazor/performance/webassembly-event-pipe-diagnostics.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,25 @@ The MSBuild properties in the following table enable profiler integration.
4141

4242
Property | Default | Set value to&hellip; | Description
4343
--- | :---: | :---: | ---
44-
`<WasmPerfTracing>` | `false` | `true` | Controls diagnostic server tracing.
45-
`<MetricsSupport>` | `false` | `true` | Controls `System.Diagnostics.Metrics` support. For more information, see the [`System.Diagnostics.Metrics` namespace](/dotnet/api/system.diagnostics.metrics).
46-
`<EventSourceSupport>` | `false`| `true` | Controls `EventPipe` support. For more information, see [Diagnostics and instrumentation: Observability and telemetry](/dotnet/core/deploying/native-aot/diagnostics#observability-and-telemetry).
47-
48-
Enabling profilers has negative size and performance impact, so don't publish an app for production with profilers enabled. In the following example, a condition is set on a property group section that only enables profiling when the app is built with `/p:BlazorSampleProfilingEnabled=true` (.NET CLI) or `<BlazorSampleProfilingEnabled>true</BlazorSampleProfilingEnabled>` in a Visual Studio publish profile, where "`BlazorSampleProfilingEnabled`" is a custom symbol name that you choose and doesn't conflict with other symbol names.
44+
`<WasmPerfTracing>` | `false` | `true` | Enables support for WebAssembly performance tracing.
45+
`<WasmPerfInstrumentation>` | No value | See table&dagger; | Enables instrumentation necessary for the sampling profiler. The property follows the :::no-loc text="callspec"::: syntax. &dagger;For permissible values, see the following table.
46+
`<MetricsSupport>` | `false` | `true` | Enables `System.Diagnostics.Metrics` support. For more information, see the [`System.Diagnostics.Metrics` namespace](/dotnet/api/system.diagnostics.metrics).
47+
`<EventSourceSupport>` | `false`| `true` | Enables `EventPipe` support. For more information, see [Diagnostics and instrumentation: Observability and telemetry](/dotnet/core/deploying/native-aot/diagnostics#observability-and-telemetry).
48+
49+
The following table describes permissable `<WasmPerfInstrumentation>` values.
50+
51+
`<WasmPerfInstrumentation>` value | Description
52+
--- | ---
53+
`all` | All assemblies
54+
`program` | Entry point assembly
55+
`{ASSEMBLY}` | Specifies an assembly (`{ASSEMBLY}`)
56+
`M:Type:{METHOD}` | Specifies a method (`{METHOD}`)
57+
`N:{NAMESPACE}` | Specifies a namespace (`{NAMESPACE}`)
58+
`T:{TYPE}` | Specifies a type (`{TYPE}`)
59+
`+EXPR` | Includes expression
60+
`-EXPR` | Excludes expression
61+
62+
Enabling profilers has negative size and performance impacts, so don't publish an app for production with profilers enabled. In the following example, a condition is set on a property group section that only enables profiling when the app is built with `/p:BlazorSampleProfilingEnabled=true` (.NET CLI) or `<BlazorSampleProfilingEnabled>true</BlazorSampleProfilingEnabled>` in a Visual Studio publish profile, where "`BlazorSampleProfilingEnabled`" is a custom symbol name that you choose and doesn't conflict with other symbol names.
4963

5064
In the app's project file (`.csproj`):
5165

@@ -60,7 +74,7 @@ In the app's project file (`.csproj`):
6074
Alternatively, enable features when the app is built with the .NET CLI. The following options passed to the `dotnet build` command mirror the preceding MS Build property configuration:
6175

6276
```dotnetcli
63-
/p:WasmPerfTracing=true /p:WasmPerfInstrumentation=true /p:MetricsSupport=true /p:EventSourceSupport=true
77+
/p:WasmPerfTracing=true /p:WasmPerfInstrumentation=all /p:MetricsSupport=true /p:EventSourceSupport=true
6478
```
6579

6680
The [`Timing-Allow-Origin` HTTP header](https://developer.mozilla.org/docs/Web/HTTP/Reference/Headers/Timing-Allow-Origin) allows for more precise time measurements.
@@ -69,13 +83,13 @@ The [`Timing-Allow-Origin` HTTP header](https://developer.mozilla.org/docs/Web/H
6983

7084
[EventPipe](/dotnet/core/diagnostics/eventpipe) is a runtime component used to collect tracing data, similar to [ETW](/windows/win32/etw/event-tracing-portal) and [perf_events](https://wikipedia.org/wiki/Perf_%28Linux%29).
7185

72-
Use the `<WasmPerfInstrumentation>` property to enable CPU sampling instrumentation for diagnostic server. This setting isn't necessary for memory dump or counters. **Makes the app execute slower. Only set this to `true` for performance profiling.**
86+
Use the `<WasmPerfInstrumentation>` property to enable CPU sampling instrumentation for diagnostic server. This setting isn't necessary for memory dump or counters. **Makes the app execute slower. Only enable this for performance profiling.**
7387

7488
Enabling profilers has negative size and performance impact, so don't publish an app for production with profilers enabled. In the following example, a condition is set on a property group section that only enables profiling when the app is built with `/p:BlazorSampleProfilingEnabled=true` (.NET CLI) or `<BlazorSampleProfilingEnabled>true</BlazorSampleProfilingEnabled>` in a Visual Studio publish profile, where "`BlazorSampleProfilingEnabled`" is a custom symbol name that you choose and doesn't conflict with other symbol names.
7589

7690
```xml
7791
<PropertyGroup Condition="'$(BlazorSampleProfilingEnabled)' == 'true'">
78-
<WasmPerfInstrumentation>true</WasmPerfInstrumentation>
92+
<WasmPerfInstrumentation>all</WasmPerfInstrumentation>
7993
</PropertyGroup>
8094
```
8195

aspnetcore/release-notes/aspnetcore-10.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: rick-anderson
44
description: Learn about the new features in ASP.NET Core 10.0.
55
ms.author: riande
66
ms.custom: mvc
7-
ms.date: 4/10/2025
7+
ms.date: 4/11/2025
88
uid: aspnetcore-10
99
---
1010
# What's new in ASP.NET Core 10.0

0 commit comments

Comments
 (0)