.NET 7 已发布第二个候选版本

.NET 7 RC2 已作为 .NET 7 的最新候选版本 (RC)发布,该版本已通过 Visual Studio 17.4 Preview 3测试,并在生产环境中得到支持。

点此下载适用于 Windows、macOS 和 Linux 的 .NET 7 RC2。如需在 Visual Studio 系列产品中试用 .NET 7,建议使用预览通道构建。 如果使用 macOS,则建议使用最新的 Visual Studio 2022 for Mac 预览版

.NET 7 RC 2 中的新增功能

为 System.Text.Json 源生成重新启用反射回退

.NET 7 引入了一项重大更改,该更改删除了 System.Text.Json 源生成器中基于反射的序列化的静默回退。 但似乎有不少用户还在依赖回退行为。因此,从 .NET 7 RC 2 开始,用户可以使用 AppContext 兼容性开关,在全局范围内重新启用反射回退。 

将以下条目添加到应用程序的项目文件中,可重新启用应用程序中所有源构建上下文的反射回退:

<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Text.Json.Serialization.EnableSourceGenReflectionFallback" Value="true" />
</ItemGroup>

有关如何使用 AppContext 开关的详细介绍,请参阅 .NET 运行时配置设置

正确实现通用数学接口(dotnet/runtime #69775

确保使用奇异递归模板模式 (CRTP) 的 .NET 通用数学接口在用户代码中正确实现。如果实现 .NET 通用数学接口(实现 CRTP 架构)的类型未使用类型本身来填充泛型类型参数,它将发出警告。例如:

public readonly struct DateOnly : IParsable<DateOnly> // correct implementation of IParsable<TSelf> interface
{ ... }
public readonly struct MyDate : IParsable<DateOnly> // Warns: "The 'IParsable<TSelf>' requires the 'TSelf' type parameter to be filled with the derived type 'MyDate' " the type parameter TSelf
{ ... }

防止内置运算符中的行为更改 IntPtr 和 UIntPtr(dotnet/runtime #74022

.NET 7 RC 2 相关链接:

扫描二维码关注公众号,回复: 14536076 查看本文章

其他内容可查看微软更新博客

猜你喜欢

转载自www.oschina.net/news/213869/dotnet-7-rc-1-released