Recently, the first preview version of .NET 7, .NET 7 Preview 1, was officially released.
.NET 7 builds on the foundation established by .NET 6 and includes a unified set of base libraries, runtimes, and SDKs that simplify the development experience and improve developer productivity. Key areas of focus for .NET 7 include improved support for cloud-native scenarios, tools to make it easier to upgrade legacy projects, and simplifying the developer experience by making it easier to use containers.
.NET 7 Preview1 includes nullable annotations for APIs, ongoing JIT compiler optimizations, new APIs, and support for more hot-reloading scenarios.
.NET 7 Preview 1 Major Updates
Nullable annotations for Microsoft.Extensions
.NET has made progress in annotating the Microsoft.Extensions.* libraries for nullability. In .NET 7 Preview 1, the following libraries have been annotated for nullability:
- Microsoft.Extensions.DependencyInjection.Abstractions
- Microsoft.Extensions.Logging.Abstractions
- Microsoft.Extensions.Primitives
- Microsoft.Extensions.FileSystemGlobbing
- Microsoft.Extensions.DependencyModel
- Microsoft.Extensions.Configuration.Abstractions
- Microsoft.Extensions.FileProviders.Abstractions
- Microsoft.Extensions.FileProviders.Physical
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.Configuration.Binder
- Microsoft.Extensions.Configuration.CommandLine
- Microsoft.Extensions.Configuration.EnvironmentVariables
- Microsoft.Extensions.Configuration.FileExtensions
- Microsoft.Extensions.Configuration.Ini
- Microsoft.Extensions.Configuration.Json
We plan to add nullability annotations to all Microsoft.Extensions.* libraries when .NET 7 is officially released.
observability
Continue to improve the tracking API:
- Added ActivityContext.TryParse overload to allow parsing and creation of ActivityContext objects, including whether to propagate the activity context from the remote parent (related issue).
- Add Activity.IsStopped method to indicate whether the Activity object is stopped (related question).
code generation
Code generation improvements based on community input
- Convert some legacy intrinsics to NamedIntrinsic. #62271
- Add additional binary operations to RangeCheck analysis. #61662
- [JIT] [61620] Optimize ARM64 for *x = dblCns; #61847
- CoreRT supports ARM64&Unix. #41023
- Override based FMA codegen optimization #58196
Dynamic PGO
- OSR support for Arm64
- JIT: OSR with support for synchronous methods
- JIT: Handling the interaction of OSR, PGO and tail calls
- Added 2009 Jit Architecture Plan (excerpt)
- JIT: forward replacement for limited versions of some relops
- JIT: save generic context for post devirtualization
Arm64
Arm64: Memory Barrier Improvements
Loop optimization
- Generalized pre-loop header creation and loop promotion
- Loop refactoring and annotation improvements
Interop: p/Invoke code generation
We integrated the p/invoke Source Generator prototyped in .NET 6 into dotnet/runtime and have been converting the runtime library to use it. This means that the converted p/invokes are AOT compatible and no longer need to generate IL Stubs at runtime.
New API in System.Text.Json
System.Text.Json comes with some small lifecycle enhancements:
- Developers now have access to the default singleton JsonSerializerOptions used internally by System.Text.Json (related issue).
- Add a JsonWriterOptions.MaxDepth property and make sure this value comes from the serialized JsonSerializerOptions.MaxDepth equivalent property (related question).
- Add Patch method to System.Net.Http.Json
Hot reload improvements
The following changes apply to Blazor WebAssembly and C# Hot Reload for .NET
- Add static lambda to existing method
- Add a lambda that captures this to an existing method that already has at least one lambda that captures this
- Add a new static or non-virtual instance method to an existing class
- Add a new static field to an existing class
- add new class
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。