wordpress 整站采集上海软件开发公司排名
wordpress 整站采集,上海软件开发公司排名,19,广告设计图片及解析点击上方蓝字关注我们#xff08;本文阅读时间#xff1a;12分钟)今天我们发布了 .NET 7 预览版 5。.NET 7 的这个预览版包括对通用数学的改进#xff0c;方便了 API 作者#xff0c;使其更轻松#xff0c;一个新的 ML.NET 文本分类 API#xff0c;增加了最先进的深度学习… 点击上方蓝字关注我们本文阅读时间12分钟)今天我们发布了 .NET 7 预览版 5。.NET 7 的这个预览版包括对通用数学的改进方便了 API 作者使其更轻松一个新的 ML.NET 文本分类 API增加了最先进的深度学习技术 对于自然语言处理对源代码生成器的各种改进以及用于 RegexGenerator 的新 Roslyn 分析器和修复器以及在 CodeGen、可观察性、JSON 序列化/反序列化和使用流方面的多项性能改进。您可以下载适用于 Windows、macOS 和 Linux 的 .NET 7 Preview 5。 安装程序和二进制文件容器图像Linux 软件包发行说明已知的问题GitHub 问题跟踪器.NET 7 预览版 5 已通过 Visual Studio 17.3 预览版 2 进行测试。如果您想将 .NET 7 与 Visual Studio 系列产品一起使用我们建议您使用预览频道版本。如果您使用的是 macOS我们建议使用最新的 Visual Studio 2022 for Mac 预览版。现在让我们了解此版本中的一些最新更新。通用数学https://devblogs.microsoft.com/dotnet/dotnet-7-generic-math/?ocidAID3042760.NET 7 Preview 5https://dotnet.microsoft.com/download/dotnet/7.0?ocidAID3042760安装程序和二进制文件https://dotnet.microsoft.com/download/dotnet/7.0?ocidAID3042760容器图像https://mcr.microsoft.com/catalog?searchdotnet/Linux 软件包https://github.com/dotnet/core/blob/master/release-notes/7.0/发行说明https://github.com/dotnet/core/tree/master/release-notes/7.0已知的问题https://github.com/dotnet/core/blob/main/release-notes/7.0/known-issues.mdGitHub 问题跟踪器https://github.com/dotnet/core/issues预览频道版本https://visualstudio.com/previewVisual Studio 2022 for Mac 预览版https://visualstudio.microsoft.com/vs/mac/preview/可观察性 可观察性的目标是帮助您更好地了解应用程序在规模和技术复杂性增加时的状态。 ▌公开高效的 ActivityEvent 和 ActivityLink 标记枚举器方法#68056公开的方法可用于在性能关键场景中枚举 Tag 对象而无需任何额外的分配和快速的项目访问。var tags new ListKeyValuePairstring, object?()
{new KeyValuePairstring, object?(tag1, value1),new KeyValuePairstring, object?(tag2, value2),
};ActivityLink link new ActivityLink(default, new ActivityTagsCollection(tags));foreach (ref readonly KeyValuePairstring, object? tag in link.EnumerateTagObjects())
{// Consume the link tags without any extra allocations or value copying.
} ActivityEvent e new ActivityEvent(SomeEvent, tags: new ActivityTagsCollection(tags));foreach (ref readonly KeyValuePairstring, object? tag in e.EnumerateTagObjects())
{// Consume the events tags without any extra allocations or value copying.
}可观察性https://devblogs.microsoft.com/dotnet/opentelemetry-net-reaches-v1-0/?ocidAID3042760#68056https://github.com/dotnet/runtime/issues/68056System.Text.Json多态性 #63747System.Text.Json 现在支持使用属性注释对多态类型层次结构进行序列化和反序列化[JsonDerivedType(typeof(Derived))]
public class Base
{public int X { get; set; }
}public class Derived : Base
{public int Y { get; set; }
}此配置为 Base 启用多态序列化特别是在运行时类型为 Derived 时Base value new Derived();
JsonSerializer.SerializeBase(value); // { X : 0, Y : 0 }请注意这不会启用多态反序列化因为有效负载将作为 Base 往返Base value JsonSerializer.DeserializeBase({ X : 0, Y : 0 });
value is Derived; // false▌使用类型鉴别器要启用多态反序列化用户需要为派生类指定类型鉴别器[JsonDerivedType(typeof(Base), typeDiscriminator: base)]
[JsonDerivedType(typeof(Derived), typeDiscriminator: derived)]
public class Base
{public int X { get; set; }
}public class Derived : Base
{public int Y { get; set; }
}现在将发出 JSON 以及类型鉴别器元数据Base value new Derived();
JsonSerializer.SerializeBase(value); // { $type : derived, X : 0, Y : 0 }可用于多态反序列化值Base value JsonSerializer.DeserializeBase({ $type : derived, X : 0, Y : 0 });
value is Derived; // true类型鉴别器标识符也可以是整数因此以下形式是有效的[JsonDerivedType(typeof(Derived1), 0)]
[JsonDerivedType(typeof(Derived2), 1)]
[JsonDerivedType(typeof(Derived3), 2)]
public class Base { }JsonSerializer.SerializeBase(new Derived2()); // { $type : 1, ... }#63747https://github.com/dotnet/runtime/issues/63747▌Utf8JsonReader.CopyString#54410直到今天Utf8JsonReader.GetString() 一直是用户使用解码后的 JSON 字符串的唯一方式。这将始终分配一个新字符串这可能不适合某些性能敏感的应用程序。新包含的 CopyString 方法允许将未转义的 UTF-8 或 UTF-16 字符串复制到用户拥有的缓冲区int valueLength reader.HasReadOnlySequence ? checked((int)ValueSequence.Length) : ValueSpan.Length;
char[] buffer ArrayPoolchar.Shared.Rent(valueLength);
int charsRead reader.CopyString(buffer);
ReadOnlySpanchar source buffer.Slice(0, charsRead);ParseUnescapedString(source); // handle the unescaped JSON string
ArrayPoolchar.Shared.Return(buffer);或者如果处理 UTF-8 更可取ReadOnlySpanbyte source stackalloc byte[0];
if (!reader.HasReadOnlySequence !reader.ValueIsEscaped)
{source reader.ValueSpan; // No need to copy to an intermediate buffer if value is span without escape sequences
}
else
{int valueLength reader.HasReadOnlySequence ? checked((int)ValueSequence.Length) : ValueSpan.Length;Spanbyte buffer valueLength 256 ? stackalloc byte[256] : new byte[valueLength];int bytesRead reader.CopyString(buffer);source buffer.Slice(0, bytesRead);
}ParseUnescapedBytes(source);#54410https://github.com/dotnet/runtime/issues/54410Utf8JsonReader.GetString()https://docs.microsoft.com/dotnet/api/system.text.json.utf8jsonreader.getstring?viewnet-6.0?ocidAID3042760▌源生成改进添加了对 IAsyncEnumerableT (#59268)、JsonDocument(#59954) 和 DateOnly/TimeOnly(#53539) 类型的源代码生成支持。 例如[JsonSerializable(typeof(typeof(MyPoco))]
public class MyContext : JsonSerializerContext {}public class MyPoco
{// Use of IAsyncEnumerable that previously resulted // in JsonSerializer.Serialize() throwing NotSupportedException public IAsyncEnumerableint Data { get; set; }
}// It now works and no longer throws NotSupportedException
JsonSerializer.Serialize(new MyPoco { Data ... }, MyContext.MyPoco);#59268:https://github.com/dotnet/runtime/issues/59268#59954:https://github.com/dotnet/runtime/issues/59954#53539https://github.com/dotnet/runtime/issues/53539System.IO.StreamReadExactly 和 ReadAtLeast #16598使用 Stream.Read() 时最常见的错误之一是 Read() 返回的数据可能比 Stream 中可用的数据少而数据也比传入的缓冲区少。即使对于意识到这一点的程序员来说 每次他们想从 Stream 中读取时都编写相同的循环很烦人。为了解决这种情况我们在 System.IO.Stream 基类中添加了新方法namespace System.IO;public partial class Stream
{public void ReadExactly(Spanbyte buffer);public void ReadExactly(byte[] buffer, int offset, int count);public ValueTask ReadExactlyAsync(Memorybyte buffer, CancellationToken cancellationToken default);public ValueTask ReadExactlyAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken default);public int ReadAtLeast(Spanbyte buffer, int minimumBytes, bool throwOnEndOfStream true);public ValueTaskint ReadAtLeastAsync(Memorybyte buffer, int minimumBytes, bool throwOnEndOfStream true, CancellationToken cancellationToken default);
}新的 ReadExactly 方法保证准确读取请求的字节数。如果流在读取请求的字节之前结束则抛出 EndOfStreamException。using FileStream f File.Open(readme.md);
byte[] buffer new byte[100];f.ReadExactly(buffer); // guaranteed to read 100 bytes from the file新的 ReadAtLeast 方法将至少读取请求的字节数。如果有更多数据可用它可以读取更多数据直到缓冲区的大小。如果流在读取请求的字节之前结束则会引发 EndOfStreamException在高级情况下当您想要 ReadAtLest 的好处但您还想自己处理流结束场景时您可以选择不引发异常。using FileStream f File.Open(readme.md);
byte[] buffer new byte[100];int bytesRead f.ReadAtLeast(buffer, 10);
// 10 bytesRead 100#16598https://github.com/dotnet/runtime/issues/16598RegexGenerator 的新 Roslyn 分析器和修复器 #69872 在 .NET 7 中的正则表达式改进中Stephen Toub 描述了新的 RegexGenerator 源生成器它允许您在编译时静态生成正则表达式从而获得更好的性能。要利用这一点首先您必须在代码中找到可以使用它的位置然后对每个代码进行更改。这听起来像是 Roslyn 分析器和修复器的完美工作所以我们在 Preview 5 中添加了一个。▌分析仪新的分析器包含在 .NET 7 中将搜索可以转换为使用 RegexGenerator 源生成器的 Regex 用途。分析器将检测 Regex 构造函数的使用以及满足以下条件的 Regex 静态方法的使用提供的参数在编译时具有已知值。源代码生成器的输出取决于这些值因此必须在编译时知道它们。它们是面向 .NET 7 的应用程序的一部分。新的分析器包含在 .NET 7 目标包中只有面向 .NET 7 的应用程序才有资格使用此分析器。LangVersion了解更多高于 10。目前正则表达式源生成器需要将 LangVersion 设置为预览。下面是 Visual Studio 中正在运行的新分析器#69872https://github.com/dotnet/runtime/pull/69872.NET 7 中的正则表达式改进中Stephen Toub 描述了新的 RegexGenerator 源生成器https://devblogs.microsoft.com/dotnet/regular-expression-improvements-in-dotnet-7/#source-generation?ocidAID3042760了解更多https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version?ocidAID3042760▌代码修复器代码修复程序也包含在 .NET 7 中它做了两件事。首先它建议使用 RegexGenerator 源生成器方法并为您提供覆盖默认名称的选项。然后它用对新方法的调用替换原始代码。以下是 Visual Studio 中正在运行的新代码修复程序通用数学 在 .NET 6 中我们预览了一个名为 Generic Math 的功能它允许 .NET 开发人员在通用代码中利用静态 API包括运算符。此功能将直接使可以简化代码库的 API 作者受益。其他开发人员将间接受益因为他们使用的 API 将开始支持更多类型而不需要每个数字类型都获得显式支持。 在 .NET 7 中我们对实现进行了改进并响应了社区的反馈。有关更改和可用 API 的更多信息请参阅我们的通用数学特定公告。Generic Mathhttps://devblogs.microsoft.com/dotnet/preview-features-in-net-6-generic-math/?ocidAID3042760通用数学特定公告https://devblogs.microsoft.com/dotnet/dotnet-7-generic-math/?ocidAID3042760System.Reflection 调用成员时的性能改进 #67917 当对同一个成员进行多次调用时使用反射来调用成员无论是方法、构造函数还是属性 gettersetter的开销已大大减少。典型增益快 3-4 倍。使用 BenchmarkDotNet 包using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Reflection;namespace ReflectionBenchmarks
{internal class Program{static void Main(string[] args){BenchmarkRunner.RunInvokeTest();}}public class InvokeTest{private MethodInfo? _method;private object[] _args new object[1] { 42 };[GlobalSetup]public void Setup(){_method typeof(InvokeTest).GetMethod(nameof(InvokeMe), BindingFlags.Public | BindingFlags.Static)!;}[Benchmark]// *** This went from ~116ns to ~39ns or 3x (66%) faster.***public void InvokeSimpleMethod() _method!.Invoke(obj: null, new object[] { 42 });[Benchmark]// *** This went from ~106ns to ~26ns or 4x (75%) faster. ***public void InvokeSimpleMethodWithCachedArgs() _method!.Invoke(obj: null, _args);public static int InvokeMe(int i) i;}
}#67917 https://github.com/dotnet/runtime/pull/67917ML.NET 文本分类 API文本分类是将标签或类别应用于文本的过程。常见用例包括将电子邮件分类为垃圾邮件或非垃圾邮件从客户评论中分析情绪是积极的还是消极的应用标签来支持工单文本分类是分类的一个子集因此今天您可以使用 ML.NET 中现有的分类算法来解决文本分类问题。然而这些算法并没有解决文本分类以及现代深度学习技术的常见挑战。我们很高兴推出 ML.NET 文本分类 API该 API 使您可以更轻松地训练自定义文本分类模型并将用于自然语言处理的最新最先进的深度学习技术引入 ML.NET。有关更多详细信息请参阅我们的 ML.NET 特定公告。ML.NET 特定公告https://devblogs.microsoft.com/dotnet/introducing-the-ml-dotnet-text-classification-api-preview/?ocidAID3042760代码生成非常感谢社区贡献者。singleaccretion 在预览版 5 期间做出了 23 项 PR 贡献其中亮点是 改进冗余分支优化以处理更多副作用 #68447PUTARG_STK/x86: 标记 push [mem] 候选 reg 可选 #68641在 LCL_FLD 上复制传播 #68592Sandreenko 完成允许 StoreLclVar src 成为 IND/FLD #59315。hez2010 修复了 #68475 中的 CircleInConvex 测试。来自anthonycanino、aromaa 和ta264 的更多贡献包含在后面的部分中。▌Arm64#68363 合并“msub”将两个寄存器值相乘从第三个寄存器值中减去乘积和“madd”将两个寄存器值相乘添加第三个寄存器值逻辑。Arm64让 CpBlkUnroll 和 InitBlkUnroll 使用 SIMD 寄存器来初始化复制小于 128 字节的内存块请参阅性能改进细节。▌循环优化#67930 处理循环克隆的更多场景现在支持以 1 的增量向后或向前的循环请参阅性能改进详细信息。#68588 提升“this”对象的空值检查将空值检查移动到循环外的对象上请参阅性能改进细节。singleaccretion:https://github.com/singleaccretion23 项 PR 贡献:https://github.com/dotnet/runtime/pulls?qis%3Apris%3Aclosedlabel%3Aarea-CodeGen-coreclrclosed%3A2022-04-18..2022-05-24author%3Asingleaccretion#68447:https://github.com/dotnet/runtime/pull/68447#68641:https://github.com/dotnet/runtime/pull/68641#68592:https://github.com/dotnet/runtime/pull/68592Sandreenko:https://github.com/Sandreenko#59315:https://github.com/dotnet/runtime/pull/59315hez2010:https://github.com/hez2010#68475:https://github.com/dotnet/runtime/pull/68475anthonycanino:https://github.com/anthonycaninoaromaa:https://github.com/aromaata264:https://github.com/ta264#68363:https://github.com/dotnet/runtime/pull/68363Arm64让 CpBlkUnroll 和 InitBlkUnroll 使用 SIMD 寄存器:https://github.com/dotnet/runtime/pull/68085性能改进细节:https://pvscmdupload.blob.core.windows.net/autofilereport/autofilereports/04_28_2022/refs/heads/main_arm64_Windows 10.0.19041_Improvement/System.Numerics.Tests.Perf_Matrix4x4.html#67930 处理循环克隆的更多场景:https://github.com/dotnet/runtime/pull/67930#68588 提升“this”对象的空值检查:https://github.com/dotnet/runtime/pull/68588性能改进细节:https://pvscmdupload.blob.core.windows.net/autofilereport/autofilereports/05_03_2022/refs/heads/main_x64_Windows 10.0.18362_Improvement/System.Text.Encodings.Web.Tests.Perf_Encoders.htmlx86/x64 优化 #67182 在 x64 上将 shlx、sarx、shrx 优化为 x64 上的 movshl、sar 或 shr 到 shlx、sarx 或 shrx。#68091为 x64 启用了 UMOD 优化。anthonycanino 在 #68677中添加了 X86Serialize 硬件内在。aromaa 在 #66965中将 bswapmov 优化为movbe。ta264 修复了 #68046 中 clr.alljits 子集的linux-x86 编译。#67182 在 x64 上将 shlxhttps://github.com/dotnet/runtime/pull/67182sarxhttps://github.com/dotnet/runtime/pull/67182shrx 优化为 x64 :https://github.com/dotnet/runtime/pull/67182#68091https://github.com/dotnet/runtime/pull/68091anthonycanino https://github.com/anthonycanino#68677 https://github.com/dotnet/runtime/pull/68677aromaa https://github.com/aromaa#66965https://github.com/dotnet/runtime/pull/66965ta264https://github.com/ta264#68046 :https://github.com/dotnet/runtime/pull/68046一般优化PR#68105 启用了多个嵌套的“no GC”区域请求。PR#69034 删除了“提升参数”尾调用限制。PR#68105https://github.com/dotnet/runtime/pull/68105PR#69034 https://github.com/dotnet/runtime/pull/69034现代化 JIT随着社区增加了对 JIT 代码库的贡献重组和现代化我们的代码库以使我们的贡献者能够轻松地增加和快速开发代码变得非常重要。 在 Preview 5 中我们在内部做了大量工作清理了 JIT 的中间表示并消除了过去设计决策带来的限制。在许多情况下这项工作导致 JIT 本身的内存使用更少和吞吐量更高而在其他情况下它导致了更好的代码质量。以下是一些亮点 删除 CLS_VAR #68524删除 GT_ARGPLACE #68140删除 GT_PUTARG_TYPE #68748以上允许我们在使用 byte/sbyte/short/ushort 类型的参数内联函数时消除 JIT 内联中的旧限制从而提高代码质量允许内联替换小参数 #69068需要改进的一个领域是更好地理解涉及读取和写入结构和结构字段的不安全代码。SingleAccretion 通过将 JIT 的内部模型转换为更通用的“物理”模型在这一领域做出了巨大的改变。这为 JIT 使用 struct reinterpretation 等功能更好地推理不安全代码铺平了道路物理值编号 #68712为 VNF_BitCast 实现常量折叠 #68979还进行了其他小的清理以简化 JIT IR删除 GTF_LATE_ARG #68617在内联候选参数中替换 GT_RET_EXPR #69117在 LIR #68460 中删除存储作为调用的操作数#68524https://github.com/dotnet/runtime/pull/68524#68140https://github.com/dotnet/runtime/pull/68140#68748https://github.com/dotnet/runtime/pull/68748#69068https://github.com/dotnet/runtime/pull/69068SingleAccretion https://github.com/SingleAccretion#68712https://github.com/dotnet/runtime/pull/68712#68979https://github.com/dotnet/runtime/pull/68979#68617https://github.com/dotnet/runtime/pull/68617#69117https://github.com/dotnet/runtime/pull/69117#68460 https://github.com/dotnet/runtime/pull/68460启用库修剪正如我们之前所描述的修剪让 SDK 从您的自包含应用程序中删除未使用的代码以使它们更小。但是修剪警告可能表明应用程序与修剪不兼容。为了使应用程序兼容它们的所有引用也必须兼容。为此我们需要库也采用修剪。在预览版 5 中我们努力使用 Roslyn 分析器更轻松地查找和修复库中的修剪警告。要查看库的修剪警告请将 IsTrimmabletrue/IsTrimmable 添加到项目文件中。修复警告后使用您的库修剪的应用程序将更小并且与修剪兼容。请参阅准备 .NET 库以进行修剪 - .NET | Microsoft Docs 了解有关库修剪的更多信息。修剪https://docs.microsoft.com/dotnet/core/deploying/trimming/trim-self-contained?ocidAID3042760请参阅准备 .NET 库以进行修剪 - .NET | Microsoft Docs https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming?ocidAID3042760面向 .NET 7要面向 .NET 7您需要在项目文件中使用 .NET 7 Target Framework Moniker (TFM)。例如 TargetFrameworknet7.0/TargetFramework全套 .NET 7 TFM包括特定于操作的 TFM。net7.0net7.0-安卓net7.0-iosnet7.0-maccatalystnet7.0-macosnet7.0-tvosnet7.0-windows我们希望从 .NET 6 升级到 .NET 7 应该很简单。请报告您在使用 .NET 7 测试现有应用程序的过程中发现的任何重大更改。支持.NET 7 是一个短期支持 (STS) 版本这意味着它将在发布之日起 18 个月内获得免费支持和补丁。需要注意的是所有版本的质量都是相同的。唯一的区别是支撑的长度。有关 .NET 支持政策的更多信息请参阅 .NET 和 .NET Core 官方支持政策。我们最近将“Current当前”名称更改为“短期支持 (STS)”。我们正在推出这一变化。.NET 和 .NET Core 官方支持政策https://dotnet.microsoft.com/platform/support/policy/dotnet-core?ocidAID3042760推出这一变化https://github.com/dotnet/core/pull/7517重大变化 您可以通过阅读 .NET 7 中的重大更改文档找到最新的 .NET 7 重大更改列表。它按区域和版本列出了重大更改并附有详细说明的链接。要查看提出了哪些重大更改但仍在审核中请关注 Proposed .NET Breaking Changes GitHub 问题。.NET 7 重大更改列表https://docs.microsoft.com/dotnet/core/compatibility/7.0?ocidAID3042760Proposed .NET Breaking Changes GitHub 问题https://github.com/dotnet/core/issues/7131路线图.NET 版本包括产品、库、运行时和工具代表了 Microsoft 内外多个团队之间的协作。您可以通过阅读产品路线图了解有关这些领域的更多信息ASP.NET Core 7 和 Blazor 路线图EF 7 路线图机器学习网络.NET MAUIWinFormsWPFNuGetRoslynRuntimeASP.NET Core 7 和 Blazor 路线图https://github.com/dotnet/aspnetcore/issues/39504EF 7 路线图https://docs.microsoft.com/ef/core/what-is-new/ef-core-7.0/plan机器学习网络https://github.com/dotnet/machinelearning/blob/main/ROADMAP.md.NET MAUIhttps://github.com/dotnet/maui/wiki/RoadmapWinFormshttps://github.com/dotnet/winforms/blob/main/docs/roadmap.mdWPFhttps://github.com/dotnet/wpf/blob/main/roadmap.mdNuGethttps://github.com/NuGet/Home/issues/11571Roslynhttps://github.com/dotnet/roslyn/blob/main/docs/Language Feature Status.mdRuntimehttps://github.com/dotnet/core/blob/main/roadmap.md我们感谢您对 .NET 的所有支持和贡献。请尝试 .NET 7 Preview 5 并告诉我们您的想法感谢https://dotnet.microsoft.com/thanks?ocidAID3042760尝试 .NET 7 Preview 5https://dotnet.microsoft.com/download/dotnet/7.0?ocidAID3042760
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/89331.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!