Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the "What's new in ASP.NET Core 10.0" for .NET 10 Preview 3 #34948

Open
sander1095 opened this issue Mar 11, 2025 · 20 comments
Open

Update the "What's new in ASP.NET Core 10.0" for .NET 10 Preview 3 #34948

sander1095 opened this issue Mar 11, 2025 · 20 comments
Assignees
Labels

Comments

@sander1095
Copy link
Contributor

sander1095 commented Mar 11, 2025

Description

Update the "What's new in ASP.NET Core 10.0" for .NET 10 Preview 3

Page URL

https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-10.0?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/release-notes/aspnetcore-10.0.md

Document ID

a7ad4b01-2333-32d8-b759-e044edfb9102

Platform Id

2f8fb8ab-5309-0a77-987a-c867c6517d2b

Article author

@Rick-Anderson

Metadata

  • ID: a7ad4b01-2333-32d8-b759-e044edfb9102
  • PlatformId: 2f8fb8ab-5309-0a77-987a-c867c6517d2b
  • Service: aspnet-core
  • Sub-service: release-notes

Related Issues

@guardrex
Copy link
Collaborator

[Blazor] Response streaming default and opt-out

Covered by the PR at #34894.

cc: @pavelsavara @campersau ... and the PR includes the latest description info from the PR, including the breaking change piece.

@maraf
Copy link
Member

maraf commented Mar 19, 2025

[Blazor] End-to-end fingerprinting of assets in standalone mode

Most of the .NET assets are fingerprinted since .NET 9, with three exceptions. These changes to the standalone application will fill the missing pieces.

During build/publish it will override placeholders in index.html with values computed during build. It will put a fingerprint into the blazor.webassembly.js script and generate an importmap for other scripts that the .NET consists of and we need to load them via script name.

This setup is specific for standalone mode. In Blazor Web these are already handled with <ImportMap /> component and @Assets collection.

index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BlazorWasmFingerprintingE2E</title>
    <base href="/" />
    ....
+    <script type="importmap"></script>
</head>

<body>
    <div id="app">
        <svg class="loading-progress">
            <circle r="40%" cx="50%" cy="50%" />
            <circle r="40%" cx="50%" cy="50%" />
        </svg>
        <div class="loading-progress-text"></div>
    </div>

    <div id="blazor-error-ui">
        An unhandled error has occurred.
        <a href="." class="reload">Reload</a>
        <span class="dismiss">🗙</span>
    </div>
-    <script src="_framework/blazor.webassembly.js"></script>
+    <script src="_framework/blazor.webassembly#[.{fingerprint}].js"></script>
</body>

</html>

blazorwasm.csproj

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
+    <WriteImportMapToHtml>true</WriteImportMapToHtml>
  </PropertyGroup>
</Project>

... resolved by #35057.

@guardrex

This comment has been minimized.

@danroth27
Copy link
Member

danroth27 commented Mar 20, 2025

Original post from @sander1095:

Other bug fixes: dotnet/aspnetcore#60937

EDIT: @Rick-Anderson

@maraf

This comment has been minimized.

@guardrex
Copy link
Collaborator

guardrex commented Mar 26, 2025

[Blazor] Rename DisableMatchAllIgnoresLeftUriPart

... to EnableMatchAllForQueryStringAndFragmentSwitchKey.

cc: @ilonatommy

... resolved by #35056.

@guardrex

This comment has been minimized.

@guardrex
Copy link
Collaborator

guardrex commented Mar 27, 2025

[Blazor] Fix use of ReconnectModal in Blazor templates

cc: @oroztocil ... I'll update the guidance for the changes that you mention.

... tracked by #35070. No changes needed.

@guardrex
Copy link
Collaborator

guardrex commented Mar 27, 2025

[Blazor] Support for declaratively persisting component and services state

cc: @javiercn ... Document now (Pre3) or wait for the dust to settle on it in a future preview?

... resolved by #35198.

@guardrex

This comment has been minimized.

@ilonatommy

This comment has been minimized.

@guardrex

This comment has been minimized.

@guardrex
Copy link
Collaborator

guardrex commented Mar 27, 2025

[Blazor] Standalone Blazor WASM MSBuild property WasmApplicationEnvironmentName to set the environment

cc : @maraf

... resolved by #35057.

@guardrex

This comment has been minimized.

@guardrex
Copy link
Collaborator

guardrex commented Mar 28, 2025

EDIT:

Validation support in Minimal APIs

Support for validation in Minimal APIs is now available. This feature allows you to request validation of data
sent to your API endpoints. When validation is enabled, the ASP.NET Core runtime will perform any validations
defined on query, header, and route parameters, as well as on the request body.
Validations can be defined using attributes in the System.ComponentModel.DataAnnotations namespace.
Developers can customize the behavior of the validation system by:

When validation fails, the runtime will return a 400 Bad Request response with
details of the validation errors.

To enable built-in validation support for minimal APIs, call the AddValidation extension method to register
the required services into the service container for your application.

builder.Services.AddValidation();

The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is then performed on these types by an endpoint filter that is added for each endpoint.

Validation can be disabled for specific endpoints by using the DisableValidation extension method.

app.MapPost("/products",
    ([EvenNumber(ErrorMessage = "Product ID must be even")] int productId, [Required] string name)
        => TypedResults.Ok(productId))
    .DisableValidation();

>>>>>>>>>> Content below is outdated. <<<<<<<<<<<<<

[Minimal APIs] Document validation support for minimal APIs

Moved here from Safia's issue at #35090 (same deal ... the original issue lacked metadata) ...

In .NET 10 Preivew 3, we're introducing support for minimal API validation support.

I've created a sample repo and some notes on the implementation to serve as source material here: https://github.com/captainsafia/minapi-validation-support.

One thing to note is that this feature has a user-facing component for developers who are building minimal APIs and a framework component for developers who are building frameworks or their own validation libraries.

I think our first priority is developers building APIs since that's where the biggest product gap it exists.

@cmastr cmastr added the 10.p3 label Apr 3, 2025
@mikekistler
Copy link
Contributor

mikekistler commented Apr 4, 2025

Add Microsoft.AspNetCore.OpenApi to the webapiaot template

Support for OpenAPI document generation with the Microsoft.AspNetCore.OpenApi packagte is now included by default in the webapiaot project template. This support can be disabled if desired by using the --no-openapi flag when creating a new project.

This was a community contribution by @sander1095. Thanks for this contribution!

@mikekistler
Copy link
Contributor

mikekistler commented Apr 4, 2025

Support for Server-Sent Events (SSE)

ASP.NET Core now supports returning a ServerSentEvents result using the TypedResults.ServerSentEvents API.
This feature is supported in both Minimal APIs and controller-based apps.

Server-Sent Events (SSE) is a server push technology that allows a server to send a stream of event messages to a
client over a single HTTP connection. In .NET the event messages are represented as SseItem objects, which may contain an event type, an ID, and a data payload of type T.

The TypedResults class has a new static method called ServerSentEvents that can be used to return a ServerSentEvents result. The first parameter to this method is an IAsyncEnumerable<SseItem<T>> that represents the stream of event messages to be sent to the client.

The following example illustrates how to use the TypedResults.ServerSentEvents API to return a stream of heart rate events as JSON objects to the client:

app.MapGet("/json-item", (CancellationToken cancellationToken) =>
{
    async IAsyncEnumerable<HeartRateEvent> GetHeartRate(
        [EnumeratorCancellation] CancellationToken cancellationToken)
    {
        while (!cancellationToken.IsCancellationRequested)
        {
            var heartRate = Random.Shared.Next(60, 100);
            yield return HeartRateEvent.Create(heartRate);
            await Task.Delay(2000, cancellationToken);
        }
    }

    return TypedResults.ServerSentEvents(GetHeartRate(cancellationToken), eventType: "heartRate");
});

EDIT: @Rick-Anderson :

@wadepickett
Copy link
Contributor

@Rick-Anderson, I don't have any here for SignalR or gRPC, so I am just picking ones at random to edit and quickly pull in as an include. I'm doing Validation support in Minimal APIs at the moment, can you pull in Add Microsoft.AspNetCore.OpenApi to the webapiaot template or Support for Server-Sent Events (SSE)?

@wadepickett
Copy link
Contributor

..moving to include and editing Add Microsoft.AspNetCore.OpenApi to the webapiaot template

@wadepickett
Copy link
Contributor

wadepickett commented Apr 10, 2025

@danroth27, @mikekistler, @danmoseley, @sander1095 and @cmastr: This What's New topic update for .NET 10 Preview 3 was published today just after the .NET 10 Prev 3 release notes link was made available on the SDK download page. Thanks everyone for the fantastic help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

9 participants