Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Aspnet Core Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-aspnet-core-knowledge-patch-nevaberry-plugins)
---
name: aspnet-core-knowledge-patch
description: ASP.NET Core
version: "11"
license: MIT
metadata:
author: Nevaberry
---
# ASP.NET Core compatibility guidance
> **Version scope:** This skill includes guidance from Microsoft’s ASP.NET Core in .NET 11 development release notes, which describe preview releases. Check the version and stability of each feature before using it with an earlier runtime. The references retain batch attribution.
Load this skill when migrating or implementing Blazor components and WebAssembly
apps, forms and validation, Identity, HTTP APIs, OpenAPI, or server hosting.
Use the quick references below for common changes and the topic files for full
conditions, examples, and batch-specific behavior.
## Reference index
| Reference | Topics |
| --- | --- |
| [Blazor components and navigation](references/blazor-components-navigation.md) | Routing, QuickGrid, virtualization, JS interop, component lifecycle, circuits, browser options, experimental AI rendering |
| [Blazor WebAssembly and tooling](references/blazor-wasm-tooling.md) | Boot assets, caching, fingerprints, preloading, environments, HTTP streaming, culture, Gateway, templates, hosted services |
| [Forms, validation, state, and Identity](references/forms-validation-state-identity.md) | Recursive and asynchronous validation, localization, persistent state, TempData, sessions, Identity redirects, time, passkeys |
| [Hosting, security, and observability](references/hosting-security-observability.md) | Authentication, authorization, SignalR, TLS, caching, compression, diagnostics, tracing, memory pools, testing |
| [OpenAPI and HTTP APIs](references/openapi-http-apis.md) | Document versions and dependencies, transformers, schemas, generation, JSON parsing and patching, binding, unions, server-sent events |
## Breaking changes and deprecations
### Blazor boot assets and caching
Boot configuration is embedded in `dotnet.js`; workflows reading
`blazor.boot.json` directly are affected. The custom boot-resource cache is
removed: remove `BlazorCacheBootResources` from the client project file.
Blazor relies on browser caching for fingerprinted client-side assets.
`blazor.web.js` and `blazor.server.js` are static web assets whose automatic
inclusion requires at least one `.razor` file. A project without components that
needs the script sets `<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>`.
### WebAssembly streaming and environment selection
Browser response streaming is enabled by default. `ReadAsStreamAsync()` can
return a `BrowserHttpReadStream` supporting only asynchronous I/O. For synchronous
reads, use `request.SetBrowserResponseStreamingEnabled(false)`, or disable
streaming globally with `<WasmEnableStreamingResponse>false</WasmEnableStreamingResponse>`
or `DOTNET_WASM_ENABLE_STREAMING_RESPONSE=0`.
Set the standalone app environment at build time with
`<WasmApplicationEnvironmentName>Staging</WasmApplicationEnvironmentName>`, replacing
configuration through `Blazor-Environment` or launch-profile `ASPNETCORE_ENVIRONMENT`.
Defaults are `Development` for builds and `Production` for publishes.
### Blazor navigation and Identity redirects
Replace the legacy `<NotFound>` fragment with a routable page through
`Router.NotFoundPage`. For `NavigationManager.NotFound()`, precedence is the path
set by `NavigationManager.OnNotFound` via `NotFoundEventArgs.Path`, then
`Router.NotFoundPage`, then the path from `UseStatusCodePagesWithReExecute`.
When enabling `BlazorDisableThrowNavigationException` in an existing Individual
Accounts app, remove the fallback `InvalidOperationException` and `[DoesNotReturn]`
annotations from `IdentityRedirectManager`. Execution continues after `NavigateTo`
during static SSR with this setting; the .NET 10 template enables it by default.
`NavigationManager.NavigateTo` no longer resets scrolling to the top for same-page
query or fragment changes. `NavLinkMatch.All` ignores the query and fragment; restore their
matching at startup with the switch shown in the navigation reference.
### API authentication and handled-exception diagnostics
Cookie authentication returns 401 for unauthenticated requests and 403 for
forbidden requests on endpoints marked with `IApiEndpointMetadata`. To restore
redirects, set `OnRedirectToLogin` and `OnRedirectToAccessDenied` to call
`context.Response.Redirect(context.RedirectUri)` and return `Task.CompletedTask`.
Exception handler middleware suppresses diagnostics by default when
`IExceptionHandler.TryHandleAsync` returns `true`. Set
`ExceptionHandlerOptions.SuppressDiagnosticsCallback` to `_ => false` to emit them.
### OpenAPI compatibility and gRPC deprecation
The ASP.NET Core in .NET 11 development notes describe OpenAPI 3.2 as the default and
`Microsoft.OpenApi` 3.3.1 as the dependency; custom transformers may need OpenAPI.NET 3 changes.
Select OpenAPI 3.1 with
`builder.Services.AddOpenApi(o => o.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_1);`.
The OpenAPI reference preserves earlier batch-specific defaults, dependency
constraints, and HTTP method behavior alongside the .NET 11 development guidance.
`Microsoft.AspNetCore.Grpc.Swagger` is deprecated.
### JSON parsing and JSON Patch
MVC, Minimal APIs, and `HttpRequest.ReadFromJsonAsync()` can pass segmented JSON
tokens to custom converters. Check `reader.HasValueSequence` and read
`reader.ValueSequence` for those tokens. Temporarily restore stream-based parsing
with `AppContext.SetSwitch("Microsoft.AspNetCore.UseStreamBasedJsonParsing", true);`.
Use `Microsoft.AspNetCore.JsonPatch.SystemTextJson` to deserialize
`JsonPatchDocument<T>` with `JsonSerializer`. `ApplyTo` uses the target's runtime
type and can leave it partially modified on failure. Apply to a copy and discard
it on failure; keep the legacy implementation for dynamic targets such as `ExpandoObject`.
### Gateway, QuickGrid, and TLS migration
Replace `Microsoft.AspNetCore.Components.WebAssembly.DevServer` with
`Microsoft.AspNetCore.Components.Gateway` for development and production. Set
`<StaticWebAssetSpaFallbackEnabled>true</StaticWebAssetSpaFallbackEnabled>` and
remove `inspectUri` from launch profiles.
QuickGrid sorting and paging use links and work in static SSR. `page` is
one-based; `sort` keys on the column's `Title`, so renaming it can break saved URLs.
Give grids distinct query keys and their own `PaginationState`. Update custom CSS
for `a.col-title`, `nav a`, and `nav a[aria-disabled="true"]`.
Replace obsolete `TlsClientHelloBytesCallback` configuration with
`listenOptions.UseTlsClientHelloListener((connection, bytes) => Console.WriteLine(bytes.Length));`
before `listenOptions.UseHttps()`.
## Forms and validation
### Recursive and asynchronous rules
For recursive Blazor validation, register `builder.Services.AddValidation()`, put
models in `.cs` files, and mark the root model with `[ValidatableType]`.
For models in a referenced project, expose a method there that calls
`AddValidation()` on the app's service collection, and call it as well as the
app's own registration. `DataAnnotationsValidator` validates nested objects and collections.
For Minimal APIs, call `AddValidation()` from the assembly defining the endpoints.
Positional record parameter attributes are recognized. Use `.DisableValidation()`
to opt an endpoint out, or `IProblemDetailsService` to customize error responses.
The validation resolver APIs are experimental; `AddValidation()` and the built-in
endpoint filter are stable. `[ValidatableType]` and `[SkipValidation]` are no longer
experimental; remove `ASP0029` suppressions added for those attributes.
Minimal APIs await `AsyncValidationAttribute.IsValidAsync(object?, ValidationContext, CancellationToken)`
and `IAsyncValidatableObject.ValidateAsync` with `AddValidation()`. Implement the
synchronous `IsValid` or `Validate` too, throwing explicitly for async-only rules.
Validators can run concurrently within a member or across collection items.
Blazor `EditForm` awaits asynchronous rules through `DataAnnotationsValidator`.
Static SSR forms using that validator get browser-side validation by default,
with or without enhanced forms. Call `AddLocalization()` before `AddValidation()`
to localize generated validation messages and display names.
## Blazor state, circuits, and rendering
### Persistence and circuit pause
Mark public service properties with `[PersistentState]` and register the service
type and render mode through `RegisterPersistentService<CartState>(RenderMode.InteractiveServer)`
on the builder returned by `AddRazorComponents()`.
Interactive components restore incoming persistent state on initial load by
default. `[PersistentState(AllowUpdates = true)]` allows updates on subsequent
enhanced navigations. `RestoreBehavior.SkipInitialValue` skips the prerendered
value; `RestoreBehavior.SkipLastSnapshot` skips the last snapshot on reconnection.
Interactive Server can restore persisted circuit state after a prolonged
disconnect or deliberate pause if the user resumes without a full-page refresh.
`await circuit.RequestCircuitPauseAsync(cancellationToken)` returning `true` means
the request was accepted and the client was asked to begin pausing. The token can
cancel the request before acceptance.
### Virtualization and cached rendering
`Virtualize` adapts to changing item heights; `OverscanCount` defaults to `15`.
`AnchorMode="End"` keeps the viewport at the end as items arrive; `AnchorMode="None"`
disables edge pinning. The default is `Start`.
Set `InitialItemIndex` for the first interactive render; use
`await list.ScrollToItemAsync(0)` afterward to align a zero-based item to the top.
Indexes are clamped, the last overlapping call wins, and calls before the first
interactive render throw. QuickGrid forwards these APIs with `Virtualize="true"`;
its `AnchorMode` and `ItemComparer` are experimental under `ASP0030`.
`CacheView` caches rendered HTML during static SSR; a cache hit skips construction
and lifecycle execution of the children inside it.
## HTTP APIs and OpenAPI
Endpoint filters run on parameter binding failures and can detect
`HttpContext.Response.StatusCode == 400`. In Development, configure
`builder.Services.Configure<RouteHandlerOptions>(options => options.ThrowOnBadRequest = false);`
to surface the 400 to the filter.
`TypedResults.ServerSentEvents(events)` accepts `IAsyncEnumerable<SseItem<T>>`
in Minimal APIs and controllers for per-event types and IDs. OpenAPI 3.2 describes
these streams using `text/event-stream` with an `itemSchema` for typed `data`,
plus the `event` and `id` string fields.
C# unions work with `System.Text.Json` for Minimal API and MVC bodies, the SignalR
JSON hub protocol, and Blazor JS interop and persisted state. Route, query, header,
and form binding require other types. OpenAPI emits `anyOf`; `[JsonUnion]` can
disambiguate overlapping JSON shapes.
Inject `IOpenApiDocumentProvider` to access documents outside endpoint requests.
Use `context.GetOrCreateSchemaAsync(typeof(ProblemDetails))` in document, operation,
or schema transformers; operation and schema transformers can add it with
`context.Document?.AddComponent("ProblemDetails", schema)`.
## Authentication and observability
Enable SignalR identity refresh with
`app.MapHub<ChatHub>("/chat", options => options.EnableAuthenticationRefresh = true);`.
Use `options.OnAuthenticationRefresh` to accept or reject a new principal and
`Hub.OnAuthenticationRefreshedAsync()` to react after application. The .NET client
enables automatic refresh by default. Interactive Server enables refresh on its
component hub and client and raises `AuthenticationStateChanged`.
The experimental `Microsoft.AspNetCore.Authentication.DeviceBoundSessions` package
layers over a cookie scheme. Supported browsers prove possession of a device key
to refresh the short-lived session cookie.
Identity uses a DI-provided `TimeProvider` for time-sensitive operations. In tests,
register `services.AddSingleton<TimeProvider>(fakeTimeProvider);` before `AddIdentity`.
Collect built-in server spans with OpenTelemetry HTTP semantic attributes through
`.WithTracing(tracing => tracing.AddSource("Microsoft.AspNetCore"))`. Set the
`Microsoft.AspNetCore.Hosting.SuppressActivityOpenTelemetryData` AppContext switch
to `true` to suppress the framework-added attributes.
Zstandard (`zstd`) is enabled by default for response compression and request
decompression when the respective middleware is used. Response compression emits
`Vary: Accept-Encoding` even for an uncompressed response.