Microsoft has introduced the release of the open platform .NET 9, developed through the unification of .NET Framework, .NET Core, and Mono. Based on .NET 9, you can create cross-platform applications for browsers, cloud systems, desktops, IoT devices, and mobile platforms, using unified libraries and a common build process, regardless of the application type. The .NET SDK 9, .NET Runtime 9, and ASP.NET Core Runtime 9 builds are available for Linux, macOS, and Windows. The .NET Desktop Runtime 9 is supplied only for Windows. Project-related developments are distributed under the MIT license.
.NET includes a runtime with the RyuJIT JIT compiler, API specifications, WPF libraries, Windows Forms, WinUI, and Entity Framework, the dotnet command-line interface, as well as tools for developing microservices, libraries, server, graphical, and console applications. An ASP.NET Core 9.0 web application development stack is provided separately, along with the Entity Framework Core 9.0 ORM layer (drivers are available, including for SQLite and PostgreSQL), WPF 9 libraries (Windows Presentation Foundation), Windows Forms 9 framework for GUI development, Aspire 9 platform for creating Cloud Native applications, MAUI 9 framework for developing cross-platform user interfaces, and releases for C# 13 and F# 9 languages. Support for .NET 9.0 and C# 13 is included in the free code editor Visual Studio Code.
Features of the new release:
- Over a thousand changes have been made related to performance optimization and improvement of the quality of generated code. The garbage collector has been modernized, which implements and is by default engaged in a mechanism for dynamic adaptation to the size of the application (the garbage collector is linked not to the availability of system resources, but to how much memory the application requires). The new mode allows for increased efficiency on systems with a large number of processor cores if the application uses relatively little memory or if memory demand fluctuates significantly during operation.
The JIT compiler has introduced new optimizations based on profiling (PGO), improving loop handling, inline expansion, and boundary checking. The .NET runtime has expanded the use of vector instructions and added support for Arm64 SVE and Intel AVX10 extensions. Exception handling code has been accelerated by 50%. For code with type casting operations, such as "(IFoo)myFoo" and "myFoo is IFoo", performance improvements of up to 70% have been recorded. The performance of certain methods in the Language-Integrated Query (LINQ), such as Take and DefaultIfEmpty, has increased by up to 10 times when working with empty arrays and collections.
Significant improvements in performance and efficiency have been made in the System.Text.Json method. The JsonProperty.WriteTo method now allows direct writing of UTF8 strings, eliminating unnecessary memory allocations. JsonObject resizing operations have been optimized. In TechEmpower benchmarks evaluating code efficiency for processing JSON requests, a performance increase of 15% and a memory consumption reduction of 93% have been observed compared to .NET 8.
- A new attribute model has been proposed in the Runtime to enable and trim functionality in libraries.
- C# 13 expands the capabilities of the "params" modifier, allowing the use of collections in addition to arrays. When initializing arrays, the "^" operator can be used to index from the end of the array (e.g., "buffer = { [^1] = 0, [^2] = 1,….}" writes 0 to the last element and 1 to the second last). In iterators and async methods, ref and unsafe expressions are allowed. A new escape sequence "\e" has been added. Defining interfaces for "ref struct" types is permitted, as well as using "ref struct" types as arguments in generic functions. A new Lock type has been proposed for establishing locks in multithreaded applications. Lock myLock = new(); void Concat<T>(params List<T> items) { lock (myLock) Console.WriteLine(string.Join("\e[1mItem: \e[0m", items)); }
- F# 9 now supports nullable types. Union types feature auto-generated properties like ".Is*" (e.g., person.contact.IsEmail) that can be used to check if a value belongs to a set. Support for empty computed expressions (e.g., "let xs = seq { }") has been added. In directives starting with "#", non-string values are now allowed (for example, you can write #nowarn 0070 instead of #nowarn "0070"). The List, Array, and Seq modules have been enhanced with functions for randomly selecting or shuffling elements. Collection operations are now permitted on lists (list and set).
- The .NET Aspire stack has been expanded, providing a set of components for building applications that run in cloud environments. New features for managing resources and the application lifecycle have been added. Telemetry collection tools have been enhanced.
- A new set of abstractions in C# for developing AI applications has been proposed, including the use of large language models, access to vector stores, and interaction with AI services. A new type "Tensor" has been introduced, along with a collection of methods for computations and manipulation of multidimensional data. AI extensions are being distributed in the form of packages System.Numerics.Tensors, Microsoft.Extensions.AI, and Microsoft.Extensions.VectorData. The ML.NET framework, designed for integrating machine learning models into applications, has been updated. The Microsoft.ML.Tokenizers library has been added for encoding and decoding text into tokens.
- In the ASP.NET Core stack for web application development, support for ahead-of-time compilation has been expanded, monitoring and tracing capabilities have been enhanced, startup times have been reduced, and memory consumption has been lowered, optimizing the handling of static files. A new API for authentication and authorization has been introduced. New templates for hybrid and web applications have been implemented in Blazor, the platform for building web applications in C#.
- The MAUI framework for developing cross-platform user interfaces has been enhanced. Performance optimizations have been carried out. Integration with desktop and mobile applications has been strengthened. New UI components TitleBar and HybridWebView have been added.
- WPF (Windows Presentation Foundation) has expanded its support for themes and added support for accent colors.
Source: opennet.ru
