微软发布 .NET 11 的第 2 个候选版本。如公告所述,该版本附带可用于生产环境部署的许可。Visual Studio 2026 Insiders 以及安装了 C# 开发工具包(Dev Kit)的 Visual Studio Code 都支持这一构建。据报道,该版本对库、运行时、SDK、NuGet、F#、ASP.NET Core、.NET MAUI 和 Windows Forms 进行了多项更新,不过并未引入新的 C# 语言特性。
在库方面,CborReader 现在可以通过 isFinalBlock 和 SlideData 读取分块传输的有效载荷,但仅限于宽松一致性模式。新增了两种实验性加密类型:CompositeMLKem 结合了后量子与经典密钥封装机制,而 Hpke 则提供仅基于经典 DHKEM 套件的混合公钥加密。
如发布说明所述,这两项功能都需要通过 SYSLIB5009 和 SYSLIB5006 进行启用。ValidationAttribute.FormatMessage 允许主机提供一个消息模板用于填充属性,而 SocketsHttpHandler.InitialHttp2MaxConcurrentStreams 则会在新建立的 HTTP/2 连接上限制并发流的数量,直到服务器的 SETTINGS 帧到达为止。
该运行时版本侧重于可靠性,但包含一项破坏性变更。在 iOS 和 tvOS 上,CoreCLR 现在默认禁用建议性文件锁定,因为如前所述,RC 1 中的 FileStream 锁定可能会导致操作系统终止进入后台的应用程序。根据发布说明,FileShare 限制在这些平台上不再强制执行,将 DOTNET_SYSTEM_IO_DISABLEFILELOCKING 设置为 0 可以恢复锁定功能。
虽然 ASP.NET Core 的新增功能不多,不过对于从 RC 1 升级的应用程序来说有几处变更。QuickGrid 的 AnchorMode 和 ItemComparer 参数已经不再属于实验性功能。IValidationMessageFormatter 已经被移除,取而代之的是 FormatMessage;Blazor BasePath 组件已经移至 Microsoft.AspNetCore.Components 命名空间;而实验性的设备绑定会话包已经从该版本中移除。正如先前的报道所言,保留下来的 AddRazorRuntimeCompilation 重载方法现在会触发 ASPDEPR003 警告。
在 SDK 中,基于文件的程序在 #:property 指令中接受带引号的值,而 #:package、#:project 和 #:ref 指令接受以 Name=Value 形式结尾的项目元数据。在项目评估过程中,MSBuild 实现了更快的通配符匹配,根据微软的 Windows 基准测试报告,其速度提高了 10–13%,同时内存占用减少了 16–34%。
NuGet 在 dotnet nuget add source 和 update source 命令中新增了 --min-publish-age-hours 选项;当包冷却期导致没有符合条件的浮动版本时,restore 操作会因 NU1020 错误而失败。
F# 包含若干预览功能。编译器新增了 return 和 await 两个内置函数,用于基于运行时异步模型构建自定义计算表达式生成器,但如说明中所述,FSharp.Core 目前尚未提供此类生成器。
let calculation () =runtimeTask {let captured = 40let! delta = delayed 2return captured + delta}
reraise() 现在已经可以在 async 和 task 表达式的 with 处理程序内使用。在非预览版中,更多的 List 和 Array 函数通过回调内联来减少内存分配,Async.parallelLimit 用于限制并发任务数量,而且,对非整型枚举进行位运算现在会在编译时因 FS0001 错误而失败。
.NET MAUI 的 maui 模板新增了一个 --ui csharp 选项。它会使用 C# 而非 XAML 生成应用程序、shell 和主页面;多项目模板则新增了一个 --avalonia 选项,用于创建 Avalonia 桌面项目。
MauiIcon 支持 Apple Icon Composer 的 .icon 包,而 UseiOSShellHandler 可以在 Apple 平台上启用基于处理程序的 Shell。Android 新增对 API 37.2 绑定和 JDK 25 的支持,而 Apple 工作负载现在需要 Xcode 27.0。而且,正如破坏性变更说明中所述,使用其 SDK 构建的应用程序必须采用 UIKit 场景生命周期。
Windows Forms 优化了 .NET 11 的视觉样式。Application.SetDefaultVisualStylesMode 用于选择渲染器版本,但目前,即使在 .NET 11 环境下,ToolStrip 和 DataGridView 仍然保持着经典渲染模式。Application.SystemVisualSettings 提供了 Windows 主题色、文本缩放和高对比度状态的系统视觉设置快照,而 FormRevealMode 会延迟顶级表单的首次显示,从而减少背景闪烁。
新增的分析器 WFO3000 至 WFO3002 会标记出无法通过 Designer 完成往返处理的代码。根据发布说明,当 AI 工具生成或重构表单时,这项功能尤为有用。
该版本的其他变更包括:在启动配置参数中支持 MSBuild 属性展开、新增 F# RequireNamedArgumentsAttribute 属性、Android 平台上默认的私有成员 R8 混淆模式、Windows Forms 中的 SuspendPainting 和 KioskModeManager 类,以及 EF Core SaveChanges 和 JSON 投影的修复。
在 Reddit 上,讨论的重点不在于功能,而在于升级频率。有评论者询问,还有多少团队会跳过奇数版本。也有人回复称,自 .NET 9 起,标准版(Standard)的终止支持日期与上一个长期支持(LTS)版本相同,因此,迁移到 .NET 11 在支持周期方面不会有什么损失。
还有开发者反映,在每次预览版升级后,MAUI 工作负载都会出现故障;有人质疑,与 Razor Pages 及 MVC 相比,Blazor 的服务器端渲染性能;也有人对面向 Windows Forms 的 KioskModeManager 组件表示欢迎。
感兴趣的读者和开发者可以在 GitHub 上的 dotnet/core 仓库中查阅 .NET 11 RC 2 的完整发布说明。
本文由 AI宝库自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
2nd candidate for Microsoft publish.NET 11. As stated in the bulletin, the version is accompanied by a permit for deployment to the production environment. This construction is supported by the Visual Studio 2026 Insiders and the Visual Studio Code, which has installed the Dev Kit. It was reported that several updates had been made to the library, running time, SDK, NuGet, F#, ASP.NET Core, NET MAUI and Windows Forms, but no new C# language characteristics had been introduced.
With regard to the library, CborReader can now read the payloads transmitted by the fractions through isFinalBlock and SlideData, but only in the case of loosely consistent modes. Two experimental types of encryption have been added: CompostiteMLKem combines the back quantum with the classic key containment mechanism, while Hpke provides mixed public key encryption based only on the classic DHKEM package.
As described in the publish Note, both functions need to be enabled through SYSLIB 5009 and SYSLIB 50006. ValidationAttribute.FormatMessage allows the host to provide a message template for filling in attributes, while SocketsHttphandler.InitialHtp2MaxConcurentStreams limits and flows on the newly created HTTP/2 connection until the server's SettinGS frame arrives.
The run-time version focuses on reliability but contains a destructive change. On iOS and tvOS, CoreCLR now defaults to lock the recommendive file because, as mentioned above, the FileStream lock in RC 1 may cause the operating system to terminate an application that enters the backstage. According to publish, FileShare limits no further enforcement on these platforms and sets DOTNET SYSTEM IO DISABLEFILOCKING to 0 to restore locking.
Although there are few additional features for ASP.NET Core, there are a few changes for an application upgraded from RC 1. The QuickGrid AngelMode and ItemComparer parameters are no longer experimental functions. IvalidationMessageFormatter has been removed and replaced by Formatmessage; Blazor BasePath component has been moved to Microsoft.AspNetCore. Components' naming space; and experimental device binding session packages have been removed from this version. As stated in previous reports, the retained AddRazor RuntmeCommilation reloading method will now trigger the ASPDEPPR003 warning.
In SDK, file-based programs accept Quoted values in #:property command, while #:package, #:project and #:ref command accepts project metadata in the form of Name=Value. In the course of the project evaluation, MSBuild achieved a faster match of wildcards, which, according to Microsoft ' s Windows benchmarking report, increased by 10-13 per cent, while memory occupancy decreased by 16-34 per cent.
NuGet has added the --min-public-age-hours option to the dotnet Nuget add source and update source command; when the package cooling period results in an unqualified floating version, the restore operation fails due to NU1020 error.
F# contains several preview functions. The compiler has added two built-in functions for return and await to build a custom calculation expression generator based on a run-time step model, but, as stated in the note, FSharp.Core does not currently provide such a generator.
let calculation () =runtimeTask {let captured = 40let! delta = delayed 2return captured + delta}
Reraise() is now available in async and task expressions with processing. In the non-prevision version, more List and Array functions reduce memory distribution by inverting, Async.parallelLimit is used to limit the number of tasks to be combined, and the biting of non-integrated number counts will now fail because of an FS0001 error at the time of compilation.
A --ui csharp option was added to the.NET Maui template. It uses C# instead of XAML to generate applications, shell and main page; a --avalonia option has been added to the multi-project template to create the Avalonia desktop item.
MauiIcon supports the.icon package of Apple Icon Composer, while UseiOSShellhandler can enable a process-based shell on the Apple platform. Android adds support for API 37.2 binding and JDK 25, while the Apple job load now requires Xcode 27.0. Moreover, as described in the damage statement, applications that use its SDK build must use the UIKit scene life cycle.
Windows Forms optimized the visual style of.NET 11. Application. SetDefaultVisualStylesMode is used to select the renderer version, but for now, even in the context of.NET 11, ToolStrip and DataGridView still have a classic rendering mode. Application. SystemVisualSettings provides a system visual setup snapshot of Windows theme colour, text scaling and high contrast status, while FormRevealMode delays the first display of top-level tables, thereby reducing background blinking.
The new analyser WFO3000 to WFO3002 will mark the code that cannot be completed through Designer. According to publish, this function is particularly useful when the AI tool generates or restructures a form.
Other changes to the version include: supporting the MSBuild properties in the startup configuration parameters, adding new F#RequireNamed ArgumentsAttribute properties, the default private member R8 confusion mode on the Android platform, the SuspendPaining and KioskModeManager categories in Windows Forms, and the restoration of the EF Core SaveChanges and JSON projection.
On Reddit, the focus of the discussion was not on functions, but on the frequency of upgrading. Some commentators asked how many teams would skip odd versions. It was also responded that since.NET 9, the end-of-service support date for Standard Edition (Standard) was the same as that for the previous long-term support (LTS) version, and that there would therefore be no loss in moving to.NET 11 in the support cycle.
It was also reported by developers that the MAUI task loads are malfunctioning each time the preview is upgraded; questions have been raised as to how Blazor's server is retrofitting compared to Razor Pages and MVCs; and the KioskModeManager component for Windows Forms has been welcomed.
The full publish description of.NET 11 RC 2 is available to interested readers and developers in the dotnet/core repository on GitHub.
Auto-fetched and translated by AI Gem Box. All rights belong to the original author.