技术速递|.NET 9 Preview 6 现已推出!

作者:.NET Team

排版:Alan Wang

现在是了解最新 .NET 9 预览版的好时机!我们刚刚发布了第六个预览版,在之前预览版的基础上添加了一些很棒的功能,并对 .NET Runtime、SDK、库、C# 和框架(包括 ASP.NET Core、Blazor 和 .NET MAUI)进行了重大改进。请查看下面链接的完整发行说明并立即开始使用。

下载 .NET 9 Preview 6

https://dotnet.microsoft.com/zh-cn/download/dotnet/9.0

此版本包含以下改进:

📚库

  • 对 System.Numerics 的改进

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#improvements-to-systemnumerics

  • 支持日志源生成器中的主构造函数

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#support-primary-constructors-in-logging-source-generator

  • System.Text.Json 增强功能包括新的 JsonSchemaExporter、可为 null 的注释识别、需要非可选构造函数参数、对 JsonObject 属性进行排序以及新的契约元数据 API

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#systemtextjson

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#jsonschemaexporter

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#respecting-nullable-annotations

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#requiring-non-optional-constructor-parameters

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#ordering-jsonobject-properties

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#additional-contract-metadata-apis

  • [GeneratedRegex] 现在可以在属性上使用

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#generatedregex-on-properties

  • Regex 的新 EnumerateSplits 方法可拆分更多集合类型

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#regexenumeratesplits

  • 引入泛型 OrderedDictionary,包括 OrderedDictionary<TKey, TValue>

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#ordereddictionarytkey-tvalue

  • 当需要围绕 ISet 创建只读包装器时,新增 ReadOnlySet<T>

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#readonlysett

  • 在库的很多地方使用 allows ref struct

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#allows-ref-struct-used-in-many-places-throughout-the-libraries

  • 使用 span 进行集合查找

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#collection-lookups-with-spans

  • 更多基于 span 的 API,包括 StartsWith 和 EndsWith 扩展方法

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#more-span-based-apis

  • 优化编码和解码的 Base64Url

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#base64url

  • 在HttpClientFactory 中默认使用 SocketsHttpHandler

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#socketshttphandler-by-default-in-httpclientfactory

  • 在 Linux 上使用客户端证书恢复 TLS

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#tls-resume-with-client-certificates-on-linux

  • 新的 System.Net.ServerSentEvents 库,提供了一个用于轻松解析服务器发送事件的解析器。

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#systemnetserversentevents

  • 在 System.Diagnostics.Metrics 中引入 Metrics Gauge Instrument,用于在发生变化时记录非附加值

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md#introducing-the-metrics-gauge-instrument

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/libraries.md

⏱️Runtime

  • ARM64 代码生成现在添加了存储操作的功能

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#arm64-code-generation

  • 代码布局 – RyuJIT 的块重新排序算法采用更简单、更全局的方法

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#code-layout

  • 用于减少代码大小和提高性能的循环优化

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#loop-optimizations

  • 通过 RyuJIT 改进减少地址暴露,以更好地跟踪局部变量地址的使用情况

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#reduced-address-exposure

  • AVX10v1 支持,这是 Intel 推出的全新 SIMD 指令集

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#avx10v1-support

  • 硬件内部代码生成

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#hardware-intrinsic-code-generation

  • 用于浮点和 SIMD 操作的常量折叠

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md#constant-folding-for-floating-point-and-simd-operations

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/runtime.md

🛠️SDK

  • NuGetAudit 现在针对传递依赖项中的漏洞发出警告

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/sdk.md#nugetaudit-now-raises-warnings-for-vulnerabilities-in-transitive-dependencies

  • 添加 dotnet nuget why 以查明项目中使用可传递包的原因

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/sdk.md#dotnet-nuget-why

  • MSBuild BuildChecks 可帮助用户在构建过程中强制执行规则和不变量

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/sdk.md#msbuild-buildchecks

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/sdk.md

您可以在下面找到有关 .NET 9 Preview 6 中附加功能的详细发行说明:

C#

  • 部分属性

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/csharp.md#partial-properties

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/csharp.md

🌐ASP.NET Core

  • 对静态 Web 资源进行指纹识别,确保不使用过时的资源,并改进缓存行为以缩短加载时间

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#fingerprinting-of-static-web-assets

  • 使用新的 ActivitySource 改进了 SignalR 的分布式跟踪

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#improved-distributed-tracing-for-signalr

  • 对 Microsoft.AspNetCore.OpenAPI 的增强,包括完成度增强、对 [Required] 和 [DefaultValue] 属性的支持、OpenAPI 文档上的架构转换

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#enhancements-to-microsoftaspnetcoreopenapi

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#completion-enhancements-and-package-install-recommendations-for-openapi-package

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#support-for-required-and-defaultvalue-attributes-on-parameters-or-properties

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#support-for-schema-transformers-on-openapi-document

  • 分析器在 [Authorize] 被 [AllowAnonymous] 覆盖时发出警告,以及新的分析器

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#analyzer-to-warn-when-authorize-is-overridden-by-allowanonymous-from-farther-away

  • ComponentPlatform 重命名为 RendererInfo

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#componentplatform-renamed-to-rendererinfo

  • 将大的 HTTP/2 头拆分到多个帧中

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md#split-large-http2-headers-across-frames

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/aspnetcore.md

📱.NET MAUI

  • 发行说明

    https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview6/dotnetmaui.md

🚀开始使用

若要开始使用 .NET 9,请安装 .NET 9 SDK。

如果您在 Windows 上使用 Visual Studio,我们建议您安装最新的 Visual Studio 2022 预览版,或者开始使用 带有 C# Dev Kit 扩展的 Visual Studio Code。

.NET 9 SDK

https://dotnet.microsoft.com/en-us/download/dotnet/9.0

Visual Studio 2022 预览版

https://visualstudio.microsoft.com/vs/preview/

C# Dev Kit 扩展

https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit

📢团队公告和讨论

团队每月都会在 dotnet/core GitHub 讨论区发布完整的发行说明和公告,社区的参与度和反馈都很高。我们将继续在 GitHub 上发布每个新版本,但随着我们即将于今年 11 月与 .NET Conf 2024 一起发布(今天就请记住这个日期!),我们希望在 .NET 博客上交叉发布我们的版本详细信息。

通过 GitHub 讨论公告与 GitHub 上的产品团队讨论此版本。

  • .NET 9 Preview 6 讨论

    https://github.com/dotnet/core/discussions/9392

  • .NET Libraries & Runtime 讨论

    https://github.com/dotnet/runtime/discussions/104620

  • .NET MAUI 讨论

    https://github.com/dotnet/maui/discussions/23506

  • ASP.NET Core 讨论

    https://github.com/dotnet/aspnetcore/discussions/56690

dotnet/core GitHub 讨论区

https://github.com/dotnet/core/discussions/categories/news

发行说明和公告

https://github.com/dotnet/core/discussions/9234

.NET Conf 2024

https://www.dotnetconf.net/

🔔了解 .NET 9 的最新动态

您可以通过以下方式了解 .NET 9 的所有新增功能:

  • .NET 9 中的新增功能

    https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview

  • C# 13 中的新增功能

    https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13

  • ASP.NET Core 中的新增功能

    https://learn.microsoft.com/aspnet/core/release-notes/aspnetcore-9.0

  • .NET MAUI 中的新增功能

    https://learn.microsoft.com/en-us/dotnet/maui/whats-new/dotnet-9?view=net-maui-8.0

  • EF Core 中的新增功能

    https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-9.0/whatsnew

  • .NET 9 中的重大更改

    https://learn.microsoft.com/en-us/dotnet/core/compatibility/9.0

  • .NET 9 版本

    https://github.com/dotnet/core/blob/main/release-notes/9.0/README.md

此外,请务必订阅 GitHub Discussions RSS 新闻源以获取所有发布公告。

我们希望得到您的反馈,因此请前往 .NET 9 Preview 6 GitHub Discussion 讨论此版本的功能并提供反馈。

RSS 新闻源

https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13

.NET 9 Preview 6 GitHub Discussion

https://github.com/dotnet/core/discussions/9392

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值