Table of Contents
We’re excited to bring you .NET 8, released on November 14 at the three-day virtual event .NET Conf 2023. This highly anticipated release is not just about new features but is a step forward that expands the capabilities of .NET. The latest version provides developers with improved performance, language features, native support, AI and more, expanding development capabilities.
Since .NET 8 is a long-term support (LTS) release, it is likely to be adopted by most .NET development teams that expect the platform to meet their needs. To help you understand what new features .NET 8 brings and why it may become a game-changer in software development, we prepared a detailed overview of .NET 8 below.
A brief evolution of the .NET framework
.NET has a tremendous history that influences its modern updates and improvements. So before we dive into the long-awaited review of .NET 8, let’s take a step back and look at the most prominent milestones in its history:
.NET Framework. Microsoft developed the .NET Framework around the end of the 1990s. It was a high-performance, multi-language environment for building and running web services. In 2002, the first version of .NET was released, and it was designed to run on Windows, primarily for desktop apps.
ASP .NET came from traditional ASP. The term “ASP” stands for Active Server Pages, a technology for creating dynamic, server-side content. Microsoft enhanced this web technology and embedded it in the .NET framework. Due to its common language runtime (CLR) technology, ASP.NET can be used with any .NET language.
ASP.NET is an open-source framework for creating dynamic and interactive web apps, services, and websites based on the .NET framework. As ASP.NET came out, web development became part of the .NET ecosystem.
.NET Core. In response to the growing demand for cross-platform development, Microsoft released ASP.NET Core in 2016. It was a modular web framework for building different types of apps. It was enhanced in terms of performance and support for cloud-based and container-based apps. By introducing .NET Core, Microsoft made progress towards cross-platform development.
.NET 5. With .NET’s evolution, it faced challenges and competitors, for example, Java. But, since the .NET 5 framework was rolled out in 2020, the .NET community has grown. .NET 5 is a free, open-source, cross-platform framework for building diverse and high-performance apps. It combines the best capabilities of .NET Core, .NET Framework, and Xamarin into a single unified platform. This platform allows developers to build diverse solutions, such as web, Windows desktop, mobile, AI to gaming.
The web framework ASP.NET Core, integrated with .NET 5, has been updated with new features. With its improvements in runtime, garbage collection, and just-in-time compilation (JIT), apps run faster than before. The updated C# 9 and F# 5 languages offered developers new features, improved syntax, and enhanced capabilities.
.NET 6, launched on November 8, 2021, is a cross-platform, open-source framework that emphasizes a unified platform for diverse apps. It has a long-term support (LTS) release, ensuring three years of support across multiple operating systems. C# 10 and F# 6 are integrated into .NET 6 to enhance developer productivity and code readability.
This release came with a lot of features and enhancements. The main of them include Dynamic Profile-Guided Optimization (PGO), integration with .NET MAUI, native AOT and changes in Blazor for creating web and native UIs. The introduction of Hot Reload feature for real-time code modification without restarting an app, is also worth noting. As a result, developers can build cross-platform applications faster and more efficiently.
.NET 7, released on November 8, 2022, is a robust, open-source framework designed for building high-performance, cloud-ready apps. It follows the standard-term support (STS) model, ensuring updates and support for 18 months. This release places a significant emphasis on performance improvements, introducing features like on-stack replacement (OSR), profile-guided optimization (PGO), enhanced code generation for Arm64, Native AOT (ideal for console apps), and advancements in the Mono runtime.
Additionally, .NET 7 incorporates C# 11 language features, F# 7, and Visual Studio 17.4, contributing to overall developer productivity and supporting a wide range of modern solutions from web, mobile to cloud-native.
Now, what about .NET 8?
Create future-proof software with our highly skilled development team
What is .NET 8?
.NET 8, was released on November 14, 2023, along with C# 12 and Visual Studio 17.8. It is the latest version of the .NET development platform, which delivers performance, stability, and security as well as platform, and tooling improvements. Altogether, they level up developers’ productivity and software development speed. It is essential for enterprises that .NET 8 has a long-term support (LTS) release. Hence, it will be supported and patched for three years rather than 18 months, like standard-term support (STS), ensuring consistent support, updates, and bug fixes.
Microsoft focuses on several improvements, including cloud integration (Aspire), enhanced performance, full-stack Blazor, Artificial Intelligence, and .NET MAUI capabilities for cross-platform development. Now, .NET 8 reshapes how developers build intelligent, cloud-native apps and high-traffic services that scale on demand. It is suitable for deploying on Linux, Windows and cloud environments. Let’s look at these features and improvements in more detail below.
Key updates in .NET 8
Compared to previous releases of .NET, at first glance, the latest version does not have many new features. However, .NET 8 was optimized with improved performance and simplified syntax. To make this happen, .NET 8 comes with the following updates:
Improved native AOT support
There are notable improvements in Native AOT (Ahead-of-Time) support in .NET 8, enhancing its capabilities even more. Native AOT support helps developers create self-contained apps compiled to native code, eliminating the need to install the .NET runtime. This optimization is highly beneficial for scenarios where fast startup times and lower resource consumption are critical, such as serverless or containerized environments, allowing .NET to compete with other solutions like Go.
A new one in AOT supports x64 and Arm64 architectures on macOS. In addition, it reduces the size of native AOT apps on Linux by up to 50%. As a result of improved native AOT compilation, developers take advantage of:
- Improved startup time;
- Increased loading speed;
- Minimized memory footprints;
- Reduced executable size;
- Eliminated the need for a Just-In-Time compiler;
- Reduced time and cost of executing the process;
- Improved user experience and satisfaction.
But native AOT also has some limitations:
- Limited compatibility with certain ASP.NET Core features and libraries;
- Requires careful navigation around constraints;
- Not all libraries support AOT compilation.
Native AOT support in .NET 8 contributes to the platform’s goals, prioritizing performance, versatility, and simplified development across diverse deployment scenarios. For developers looking to create high-performance, self-contained apps, native AOT compilation in .NET 8 offers a significant benefit. AOT compatibility and additional libraries and features will be improved in future versions.
Unparalleled performance
.NET 8 is known for its unparalleled performance across the stack compared to previous versions. It comes from a new code generator, Dynamic Profile-Guided Optimization (PGO), by default. In .NET 8, it optimizes code based on the AVX-512 instruction set, enabling parallel operations on 512-bit data vectors for faster processing of more data in less time. As a result, the performance of apps is improved by up to 20%, providing a better user experience and reduced bounce rates.
Also, .NET 8 introduces a new formattable and parsable interface for primitive types, especially numerical types. This interface facilitates direct formatting and parsing in UTF-8 without transcoding overhead. With .NET 8, developers can work with numerical data more efficiently, which increases application speed and responsiveness. Due to this, .NET 8 is up to 24% faster than .NET 7 (according to the Fortunes benchmark).
.NET Aspire
While .NET 8 includes some cloud-native features, the most prominent is the first preview of .NET Aspire. It is a cloud-ready stack for creating observable, production-ready, configurable cloud-native apps. It simplifies the development process by providing valuable abstractions for managing service discovery, environment variables, and container configurations without handling low-level details. For this, .NET Aspire comes with a set of components, such as:
- Service discovery: to help developers discover and configure essential dependencies for cloud-native apps;
- Telemetry: telemetry components that collect and analyze data about the application’s performance, allowing developers to monitor and optimize their apps;
- Resilience: to handle failures and provide disaster recovery mechanisms, ensuring the availability and reliability of apps;
- Health Checks: health check components to help developers monitor the health of their apps and identify potential issues.
.NET Aspire is designed to work with various cloud providers, such as Azure, and is not tied to any specific cloud platform. It simplifies the complexity of building cloud-native apps by providing NuGet packages to address particular cloud computing issues. But the first preview version of .NET Aspire comes with .NET 8 and will be available in spring of 2024.
.NET 8 container enhancements
The container images continue to be optimized, and .NET 8 brings many containerization updates to simplify the building, deployment, and management of apps that run consistently in various environments. Among them are:
- Non-root user: every .NET image includes a non-root user, enabling more secure containers through one-line configuration;
- Generated-image defaults: you can use .NET containers without root access, helping your apps remain secure by default;
- Build multi-platform container images: .NET 8 allows you to build multi-platform container images, improving compatibility and flexibility;
- ASP.NET composite images: ASP.NET Docker images that contain a composite version of the runtime simplify deployment and make the runtime easily accessible;
- Container size: .NET 8 optimizes container sizes for smaller, more resource-efficient container images;
- Container publishing: the .NET SDK tooling now publishes container images without a Dockerfile and is non-root by default, making deployment faster;
- Chiseled Ubuntu images: .NET 8 offers optional Chiseled Ubuntu images for versatile architecture support;
- Simplified testing on Kubernetes: .NET 8 introduces an environment variable for the User Identification (UID) of the non-root, making Kubernetes testing easier.
Improved Artificial Intelligence
With .NET 8, AI integration has become more seamless, faster, and stable. .NET 8 added many features, including improved AI support for developers. Now it is easy for them to apply AI with top-notch, out-of-the-box AI features in the .NET SDK and seamlessly integrate them with multiple tools. Other AI-related features include:
- Integration with generative AI workloads: .NET 8 introduces enhancements to the System.Numerics library to improve its compatibility with generative AI workloads, such as integrating Tensor Primitives;
- Collaboration with AI partners: .NET 8 has collaborated with partners like Azure OpenAI, Azure Cognitive Search, and Microsoft Teams to provide easy access to various AI models, services, and platforms through their SDKs;
- Open-source Semantic Kernel SDK: this SDK simplifies the integration of AI components into new and existing apps, helping developers build innovative user experiences;
- Pre-built AI models: with .NET 8, developers can easily add advanced features to their apps through pre-built AI models, such as emotion, sentiment detection, or search;
- ML.NET framework: developers can build, train, and deploy high-quality custom ML models for various scenarios with new metrics APIs, anomaly detection algorithms, and TensorFlow.
These features make .NET apps more AI-ready, providing tech-savvy users with unique AI-powered experiences.
Blazor
Improved Blazor is another update in .NET 8, offering a full-stack web UI framework that supports both server-side rendering (Blazor WebAssembly) and client-side (Blazor Server) in a single programming model. With Blazor components, developers can build any type of web UI with different rendering models for static, interactive, and hybrid scenarios. It also lets developers dynamically switch between server and client at runtime, reducing page load time. Apart from that, Blazor has the following features:
- Statiс server-side rendering;
- Enhanced navigation and form handling;
- Data display using the QuickGrid;
- Identity authentication;
- Auto-select rendering at runtime;
- Per-component interactivity;
- Streaming rendering.
These features, along with the unified hosting models and improved project structure, make Blazor in .NET 8 a powerful tool for developers looking to build modern web apps with a rich and interactive user experience.
Enhanced .NET MAUI
.NET Multi-platform App UI extends the developer’s toolkit, offering a single framework for building cross-platform mobile and desktop apps. With .NET 8, .NET MAUI prioritizes quality with a focus on enhancing performance and fixing bugs. Also, it aligns with the latest Xcode 15 and Android API 34 versions, allowing developers to build robust apps in the latest environments. Other features of the .NET MAUI include:
- Controls: NET 8 includes new controls, such as drag-and-drop enhancements on Windows, Mac Catalyst, and iOS, allowing developers to create more interactive and user-friendly apps;
- Type deprecation and removal: although the release notes do not explicitly mention type deprecation or removal, it is common for .NET MAUI to change its API surface, which may impact developers using specific types of features;
- Behavior changes: .NET 8 brings essential high-priority fixes in areas like layout, memory leaks, and CollectionView. It also introduces new functionality, such as Controls that support text input gaining extension methods for hiding and showing the soft input keyboard, and the ContentPage class gaining a HideSoftInputOnTapped property;
- Performance: there are plenty of performance changes in .NET MAUI 8, including new features, AndroidStripILAfterAOT, AndroidEnableMarshalMethods, NativeAOT on iOS, resulting in a significant increase in quality.
These advancements improve cross-platform app performance and quality. In turn, using .NET MAUI helps developers to reduce development time and costs and accelerates time-to-market for their apps. MAUI has many out-of-the-box controls and layouts, so developers do not have to write custom controls or rely on third-party libraries. Instead, they can focus on adding more features and improving user experience.
C# 12 features: simplified syntax
As we said above, along with the advent of .NET 8, the C# 12 programming language was rolled out. The language has several new features that aim to make code more readable and syntax simplified. Features that simplify code include:
Collection expressions: collection expressions introduce a new terse syntax to create common collection values. They allow developers to create and manipulate collections more efficiently. For example, collection-like types can be created without requiring external BCL support like Array types, such as int[], System.Span<T> and System.ReadOnlySpan<T> and types that support collection initializers, such as System.Collections.Generic.List<T>:
// Create an array:
int[] a = [1, 2, 3, 4, 5, 6, 7, 8];
// Create a list:
List<string> b = ["one", "two", "three"];
// Create a span
Span<char> c = ['a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'];
// Create a jagged 2D array:
int[][] twoD = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
Primary constructors: developers can create primary constructors in any class and struct, not just for record types:
public class BankAccount(string accountID, string owner)
{
public string AccountID { get; } = accountID;
public string Owner { get; } = owner;
public override string ToString() {
return $"Account ID: {AccountID}, Owner: {Owner}";
}
}
Optional parameters in lambda expressions: this feature allows developers to provide default values for parameters in lambda expressions:
var IncrementBy = (int source, int increment = 1) => source + increment;
Console.WriteLine(IncrementBy(5)); // 6
Console.WriteLine(IncrementBy(5, 2)); // 7
Alias any type: developers can use any keyword to create an alias of any type, making the code more readable and maintainable, but do remember to use more structural approaches when dealing with complex types:
using Point = (int x, int y);
Features for improved performance:
- Ref readonly parameters: it lets developers pass variables and values as parameters without any annotations;
- Inline arrays: developers can create arrays inline, simplifying the syntax for creating and using arrays;
- JIT compiler improvements: C# 12 includes performance improvements in the JIT compiler for Arm64 and dynamic PGO (Profile Guided Optimization).
Experimental features:
- Experimental attribute: this feature is available in preview mode and allows developers to experiment with new features before they become stable;
- Interceptors: this feature enables developers to reroute method calls without changing the original code (not recommended for production).
Overall, a simplified syntax makes it easier for developers to understand code they encounter for the first time, which reduces the time spent fixing it. As a result, developers can write clear, concise, and maintainable code using the latest Visual Studio 2022 version or the .NET 8 SDK.
What Can We Already Expect From .NET 7?
Even though there is no official release date for .NET 7 yet, the development team has already announced…
Support of Visual Studio toolkits
One of the features of .NET 8 is support across the Visual Studio toolkits. This means developers can use the latest version of .NET 8 with Visual Studio and Visual Studio Code. As a result, they can seamlessly develop across various platforms, including macOS and GitHub Codespaces. The Visual Studio for Mac does not yet support .NET 8 previews, but it will soon. For building and running .NET apps on Linux with .NET 8, developers can download the .NET SDK from the dotnet/botnet repository. In this way, developers can use the IDE and platform of their choice.
Additionally, Microsoft released a new version of Visual Studio that supports the latest version of .NET 8 for Windows, Mac, and Linux. Visual Studio 17.8 offers a set of improvements in productivity, programming languages, and enterprise management, enhancing the working process with .NET 8. Some of the Visual Studio 17.8 features and enhancements include:
- Performance enhancements: it offers improved Razor/Blazor responsiveness, enhanced F5 speed, and build acceleration for non-SDK style .NET projects;
- C# 12 language enhancements: it supports C# 12 language enhancements, which bring improvements to code conciseness and expressiveness;
- ASP.NET Core 8 and Entity Framework Core 8: it supports the latest versions of ASP.NET Core and Entity Framework Core, providing developers with updated tools and features.
Thus, the support of .NET 8 across the Visual Studio family of tools enables developers to work with the latest version of .NET on different platforms, providing a consistent and seamless development experience.
A brief comparison: .NET 6 vs .NET 7 vs .NET 8
Here’s a brief table to see how the .NET framework is evolving, what direction it’s going in, and what the latest release has achieved.
.NET 6 | .NET 7 | .NET 8 | |
---|---|---|---|
Release date | LTS (long-term support) | STS (standard term support) | LTS (long-term support) |
Performance | Improved JIT (Just-In-Time) compilation, a code generator Dynamic Profile-Guided Optimization (PGO) and native AOT produces (with support Blazor WebAssembly) | 3X faster with improved PGO, Native AOT, performance improvements to the Mono runtime, which powers Blazor WebAssembly, Android, and iOS apps | Up to 24% faster performance due to enhanced native AOT, code generation with vectorization and inlining, generational garbage collection and optimized ASP.NET Core and .NET MAUI |
Cloud support | Improved scalability, deployment flexibility, and performance for cloud-native apps | Better cold startup time with AOT in serverless environment | Support .NET Aspire for resilient, observable, and configurable cloud-native apps |
Cross-platform capabilities | Support of macOS Arm64 (or “Apple Silicon”) and Windows Arm64 operating systems, for both native Arm64 execution and x64 emulation, Blazor for desktop | Maintain compatibility and ease of development across various platforms, like Windows, macOS, and Linux | Improved support for ARM64, WebAssembly, and additional Linux distributions, and introduction of Aspire to build observable, production-ready, configurable |
Artificial Intelligence | Initial support for AI and ML | ML.NET now includes a text classification API that makes it easy to train custom text classification models using the latest modern deep learning techniques | Improved AI support with pre-built models and collaboration with AI partners |
.NET MAUI integration | Introduced .NET MAUI for cross-platform app development (in preview) | Improvements of performance on Android and reduce app size on iOS | Quality of life and performance enhancements for .NET MAU, providing a single codebase for multiple platforms |
Web development | Features as Minimal API, support HTTP/3 | ASP.NET Core performance enhancements | Blazor WebAssembly supporting, ASP.NET Core performance and scalability improvements |
Final thoughts
.NET 8 is a meaningful release because it reflects the current and future needs of the software industry. This article listed only the most paramount updates in .NET 8 that help developers build innovative solutions, leveraging the power of the cloud and AI. .NET 8 also simplifies the development process by reducing the amount of code and configuration required. As a result of unrivaled performance, improved cross-platform compatibility, native support, and language extensions, developers will be able to create the next generation of apps. No matter what type of application you are planning to create- web, mobile, distributed, or cloud-native – .NET 8 will provide you with the needed capabilities to succeed.
Whether it’s true or not, we’ll see in the future. Until then, let us know if you found something important for you that wasn’t mentioned in the article.
Expert Opinion
As usual, November is the momentous month for each .Net developer. And the 8th version, presented in November 2023, did not disappoint. The most high-profile novelty is .Net Aspire, which helps developers to organize microservice chaos. It would be nice if a future version of .Net Aspire included support for multiple repositories, although the current version can help many programmers. Blazor has been significantly upgraded to create full-stack apps running on web and mobile devices. It looks highly competitive now with other “any-screen” solutions like Flutter. Furthermore, hundreds of changes have improved performance, stability, and functionality.
Summarizing, the 8th version is yet another significant step in the evolution of .Net. It keeps .Net on the cutting edge of development technologies.
Head of .NET Department
Roman Ogolikhin
Comments