-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
What's new in .NET 7 Preview 3 [WIP] #7108
Comments
Observability // ActivityListener Sampling callback
listener.Sample = (ref ActivityCreationOptions<ActivityContext> activityOptions) =>
{
activityOptions = activityOptions with { TraceState = "rojo=00f067aa0ba902b7" };
return ActivitySamplingResult.AllDataAndRecorded;
}; |
System.Composition.HostingProviding APIs to allow adding a single object instance to the System.Composition.Hosting container. Similar to the functionality provided in the legacy interfaces System.ComponentModel.Composition.Hosting with the API ComposeExportedValue(CompositionContainer, T) namespace System.Composition.Hosting
{
public class ContainerConfiguration
{
public ContainerConfiguration WithExport<TExport>(TExport exportedInstance);
public ContainerConfiguration WithExport<TExport>(TExport exportedInstance, string contractName = null, IDictionary<string, object> metadata = null);
public ContainerConfiguration WithExport(Type contractType, object exportedInstance);
public ContainerConfiguration WithExport(Type contractType, object exportedInstance, string contractName = null, IDictionary<string, object> metadata = null);
}
} |
Startup time improvements with Write-Xor-Execute enabledThe dotnet/runtime#65738 reimplemented the precode and call counting stubs (tiered compilation helper stubs) to significantly reduce number of post-creation modifications of executable code in the runtime. This resulted in 10-15% startup time improvements. As a bonus, this change also resulted in steady state performance improvements (upto 8%) in some microbenchmarks and some ASPNet Benchmarks even without Write-Xor-Execute enabled. However, there are few regressions resulting from that change too (without Write-Xor-Execute enabled) that will be addressed in the upcoming preview releases. These were observed in the Orchard and Fortunes benchmarks on Intel processors only. |
GC Regions Enabled by defaultWith Preview 3, regions functionality which should help with memory utilization for high throughput applications has been enabled by default. The functionality is now enabled for all Platforms except MacOS and NativeAOT (which would be enabled in the future). More details are available in this issue: dotnet/runtime#43844 We expect some working set increases for smaller applications due to how regions are initially allocated. If you notice any functional or performance differences please create an issue within the runtime repo. |
NativeAOT UpdateIn the .NET 7 Preview 2 blog post, we announced that the NativeAOT project has been moved out of experimental status and into mainline development in .NET 7 in the dotnet/runtime repo. We know that many of you have been eagerly awaiting updates from the team on what’s coming for NativeAOT, and we have a couple of new updates for you for Preview 3! If you want details about NativeAOT, or to jump in and get started with it, the repo docs are the best place for that. We also recognize that some of you might not be familiar with what NativeAOT is, so we wanted to share a quick overview of it with you. What is NativeAOT?AOT, ahead-of-time compilation, refers to an umbrella of technologies which generate code at application build time, instead of run-time. AOT is not new to .NET Core - we ship ReadyToRun for client and server scenarios, and Mono AOT for Mobile and WASM. NativeAOT brings full native pre-compilation to .NET Core desktop client and server scenarios. NativeAOT is not replacing these existing technologies, rather offering a new set of capabilities that unlocks new form factors. Existing AOT-compiled .NET assemblies contain platform-specific data structures and native code to frontload work typically done at runtime. Precompiling these artifacts saves time at startup (e.g. ReadyToRun), and enables access to no-JIT platforms (e.g. iOS). If precompiled artifacts are not present, .NET either falls back to JIT or interpretation (depending on the platform). NativeAOT is similar to .NET Core’s existing AOT technologies, but it produces only native artifacts. In fact, the NativeAOT runtime does not know how to read the .NET assembly file formats - everything is platform-native; the executable file format parsing is fully handled by the underlying operating system. The main advantage of NativeAOT is in startup time, memory usage, accessing to restricted platforms (no JIT allowed), and smaller size on disk. Applications start running the moment the operating system pages in them into memory. The data structures are optimized for running AOT generated code, not for compiling new code at runtime. This is similar to how languages like Go, Swift, and Rust compile. NativeAOT is best suited for environments where startup time matters the most. Targeting NativeAOT has stricter requirements than general .NET Core applications and libraries. NativeAOT forbids emitting new code at runtime (e.g. Reflection.Emit), and loading new .NET assemblies at runtime (eg. plug-in models). Prepare your apps for NativeAOTFor .NET 7 we are targeting console apps and native libraries as the primary scenario for NativeAOT. Application developers and library authors can now take advantage of NativeAOT by ensuring that their applications are trimmable. Since trimming is a requirement for NativeAOT compilation, preparing your applications and libraries now for trimming will help them get ready for NativeAOT as well. If you are an author of any .NET libraries, following the “Trimming libraries” instructions specifically will help you prepare your libraries for trimming and NativeAOT. One of the apps that we're planning to ship in .NET 7 compiled with NativeAOT is the crossgen tool. Crossgen is part of the .NET SDK - it's the CoreCLR AOT compiler that produces ReadyToRun executables. Crossgen is written in C# and we currently ship it compiled with itself as a ReadyToRun app (it's turtles all the way down!). We're already seeing some very promising numbers in terms of compilation speed and size. Crossgen benefits heavily from NativeAOT because it's a short-lived process and the startup overhead dominates the overall execution time:
Looking ahead, NativeAOT compatibility will be improved over the next few versions of .NET, however there will always be reasons to prefer JIT for many scenarios. We will also add first-class support in the dotnet SDK for publishing projects with NativeAOT. |
thanks to .net team for amazing features in each update. |
i think it can't got from this dotnet/runtime#45471 (comment) |
Cryptography: Generating X.500 names more robustlyClassically, anyone wanting to build a X.500 name (such as for creating test certificates with the request = new CertificateRequest($"CN={subjectName},OU=Test,O=""Fabrikam, Inc.""", ...); This is generally fine, except for when X500DistinguishedNameBuilder nameBuilder = new();
nameBuilder.AddCommonName(subjectName);
nameBuilder.AddOrganizationalUnitName("Test");
nameBuilder.AddOrganizationName("Fabrikam, Inc.");
request = new CertificateRequest(nameBuilder.Build(), ...); |
Cryptography: EventSource for X509Chain on LinuxX.509 certificate chain building has a lot of pieces and moving parts. While it reports detailed reasons for failure as part of the API, sometimes it's useful when diagnosing issues to see when something happened, or how long it took, et cetera. On Windows the logging is done by the OS, as part of "CAPI2 Diagnostics", but on Linux we had no equivalent. Starting in .NET 7 Preview 3 the traces are produced by the
|
System.ThreadingThe managed implementation of the thread pool is now used by default for handling IO completions on Windows. IO completions are queried in batches on fewer threads, which can be a bit more efficient, and are processed at higher priority in the same worker thread pool to reduce oversubscription. If The previous implementation of IO completion handling can be restored by setting the environment variable |
This appears to have not made it into the blog post. The only mention of the new threadpool features I could find on the blog was in the performance improvements post. And this issue is the only hit on Google for the new Should this change be documented or publicized like how the portable thread pool was announced in the blog post for .NET 6 preview 1? It's a cool feature! |
.NET 7 GA is available. Closing these pre-release issues. |
What's new in .NET 7 Preview 3
This issue is for teams to highlight work for the community that will release .NET 7 Preview 1
To add content, use a new conversation entry. The entry should include the team name and feature title as the first line as shown in the template below.
Preview 1: #7106
Preview 2: #7107
Preview 3: #7108
Preview 4: #7378
Preview 5: #7441
Preview 6: #7454
Preview 7: #7455
The text was updated successfully, but these errors were encountered: