
.NET 10 is the latest long-term support (LTS) release in the .NET ecosystem, succeeding .NET 9. This release brings significant enhancements across the .NET runtime, libraries, SDK, and various frameworks, further improving performance, usability, and developer productivity.
.NET Runtime Enhancements
Array Interface Method Devirtualization
One of the key optimizations in .NET 10 focuses on reducing the abstraction overhead of popular language features. The JIT compiler now devirtualizes method calls on array interface methods, enabling improved performance.
Consider a simple array summation:
This pattern is easily optimized by the JIT. However, when using an interface:
Previously, the JIT could not devirtualize these calls, blocking optimizations like inlining and stack allocation. With .NET 10, these array interface methods are now devirtualized, resulting in performance parity between both implementations.
Stack Allocation of Arrays of Value Types
.NET 9 introduced stack allocation for objects that do not outlive their parent method. .NET 10 extends this to small, fixed-sized arrays of value types without GC pointers.
Example
Since numbers are a small, fixed-size array known at compile time, the JIT will allocate it on the stack, reducing GC overhead and unlocking further optimizations.
Among other stack allocation enhancements, .NET 10 aims to expand this optimization to reference type arrays in future previews.
Improvements in .NET Libraries
.NET 10 expands its library capabilities with new features and API enhancements. Key improvements include:
Finding Certificates By ThumbprintsFinding
A new FindByThumbprint method for certificate handling, allowing hash algorithms beyond SHA-1.
PEM-encoded data from ASCII-encoded files
Support for reading PEM-encoded data from ASCII-encoded files.
ISOWeek for DateOnly Type
Enhancements to the ISOWeek class now support the DateOnly type.
String normalization APIs
Unicode string normalization APIs that work with spans of characters.
Numeric Ordering for String Comparison
A new CompareOptions.NumericOrdering option for numerical string comparison.
TryAdd and TryGetValue overloads for OrderedDictionary<TKey, TValue>
New TryAdd and TryGetValue overloads for OrderedDictionary<TKey, TValue>, returning an entry index.
Allow specifying ReferenceHandler in JsonSourceGenerationOptions
JSON serialization improvements, including ReferenceHandler support in JsonSourceGenerationOptionsAttribute.
.NET SDK Enhancements
.NET 10 Preview 1 introduces significant enhancements to the .NET SDK, particularly in package management. One notable feature is the pruning of framework-provided package references. This functionality, enabled by default for .NET TargetFrameworks like net8.0 and net10.0, as well as .NET Standard 2.0 and above, helps reduce unnecessary packages during the build process. Removing unused framework-provided packages leads to faster build times and less disk space usage. Additionally, it minimizes false positives from NuGet Audit and similar tools.
When enabled, this feature simplifies the .deps.json files by automatically removing redundant package references supplied by the .NET Runtime. Users can disable this feature by setting RestoreEnablePackagePruning to false in their project file or Directory.Build.props. However, doing so may trigger warnings like NU1510, which indicate unnecessary direct package references. Addressing these warnings involves either conditioning or removing those references.
ASP.NET Core 10 Enhancements
ASP.NET Core 10 brings a range of updates across various components:
- Blazor: Introduces the RowClass parameter in QuickGrid and enables Blazor script to serve as a static web asset.
- SignalR: New feature enhancements for real-time applications.
- Minimal APIs: Additional capabilities for defining lightweight APIs.
- OpenAPI: Support for generating OpenAPI 3.1 documents and serving them in YAML format.
- Authentication & Authorization: Various improvements to security-related features.
- Miscellaneous: Enhancements in testing apps with top-level statements and a new helper for detecting local URLs.
.NET MAUI Improvements
.NET 10 Preview 1 introduces several quality improvements for .NET MAUI, enhancing its stability and performance across platforms like Android, iOS, Mac Catalyst, macOS, and tvOS.
CollectionView Enhancements for iOS & Mac Catalyst
- .NET 10 enables new handlers for CollectionView and CarouselView by default, improving performance and stability.
- Developers can opt-out and revert to the previous handlers using the following code:
Entity Framework (EF) Core 10 Enhancements
EF Core 10 introduces several refinements:
- LINQ and SQL translation improvements for better query optimization.
- ExecuteUpdateAsync now supports regular, non-expression lambda parameters.
C# 14: Advancements in Language Features
C# 14 debuts with multiple features enhancing code maintainability and expressiveness:
- nameof support in unbound generics.
- Implicit span conversions for improved memory safety.
- Field-backed properties for better encapsulation.
- Modifiers on simple lambda parameters.
- Experimental feature: String literals in data sections.
If you want to learn more about C# 14, please go through the detailed article: C# 14 - New Features and Updates
Windows Forms Updates
Windows Forms in .NET 10 brings significant clipboard-related updates:
Changes to clipboard serialization and deserialization. Deprecation of certain clipboard APIs. Introduction of new clipboard-related APIs for enhanced data handling.
Conclusion
.NET 10 continues to evolve with improvements across performance, runtime optimizations, library enhancements, and new development features. With long-term support, this release ensures stability for enterprise applications while offering cutting-edge capabilities for modern development needs.