Microsoft Ships .NET 8
In announcing .NET 8 today, Microsoft emphasized the cloud, performance, full-stack Blazor, AI and .NET MAUI as major highlights of the latest edition of the company's free, cross-platform, open source developer platform.
The emphasis on cloud was readily apparent right off the bat. "With this release, .NET reshapes the way we build intelligent, cloud-native, applications and high-traffic services that scale on demand," Microsoft said Tuesday as its .NET Conf 2023 event kicked off. "Whether you're deploying to Linux or Windows, using containers or a cloud app model of your choice, .NET 8 makes building these apps easier."
So what can you do with .NET 8? Microsoft listed:
- Integrate large language models (LLMs) like OpenAI's GPT directly into your .NET app.
- Use a single powerful component model to handle all your web UI needs with Blazor.
- Deploy your mobile applications to the latest version of iOS and Android with .NET MAUI.
- Discover new language enhancements that make your code more concise and expressive with C# 12.
Of special importance to enterprises, .NET 8 is a long term support (LTS) release (issued in odd-numbered years like 2023), which means it will be supported and patched for three years as opposed to 18 months for a standard term support (STS) release.
Of special importance to developers is Microsoft progressing on its journey to long-awaited native ahead-of-time compilation (native AOT), a focus point in preview 6.
Years ago, the absence of Native AOT in .NET Core was identified in a survey as holding back adoption of the development platform, prompting Microsoft to make a big AOT push.
Microsoft said .NET 8 enhances sustainable compute by advancing Native AOT in order to reduce memory usage and achieve instant application start-up, today highlighting features of AOT including:
- It compiles apps into native code that uses less memory and starts instantly
- No need to wait for the JIT (just-in-time) compiler to compile the code at runtime
- No need to deploy the JIT compiler and IL code
- AOT apps deploy just the code that's needed for an app
- An app is now empowered to run in restricted environments where a JIT compiler is not allowed
Native AOT size optimizations were also depicted.
In describing .NET 8 overall, Microsoft said: "NET 8 delivers thousands of performance, stability and security improvements, as well as platform and tooling enhancements that help increase developer productivity and speed of innovation."
In the announcement post, those thousands of improvements were grouped around the five topics mentioned above. Here's a look at each area.
Each year, .NET performance is thoroughly, painstakingly and exhaustively detailed in massive tomes published by Microsoft's Stephen Toub, who boiled down thousands of performance data points to declare: .NET 7 was super fast. .NET 8 is faster.
Digging into some of the new details, .NET 8 introduces a new code generator, Dynamic Profile-Guided Optimization (PGO), which optimizes code based on real-world usage. This feature can improve app performance by up to 20 percent. The AVX-512 instruction set, which enables parallel operations on 512-bit vectors of data, is supported and used in .NET 8, allowing for much more data processing in less time. Also, Primitive types now implement a new formattable and parsable interface, enabling them to directly format and parse as UTF-8 without any transcoding overhead.
While .NET 8 includes boosts cloud-native development in a number of ways, including many container enhancements for example, the big news here is the availability of the first preview of .NET Aspire, an opinionated stack for building resilient, observable and configurable cloud-native applications.
In this context, "opinionated" means the tech guides users into a certain way of doing things or is designed with specific conventions and assumptions about the best way to do things, and .NET Aspire comes with a curated set of components enhanced for cloud-native development, including telemetry, resilience, configuration and health checks by default.
"Combined with a sophisticated but simple local developer experience, Aspire makes it easy to discover, acquire and configure essential dependencies for cloud-native applications on day 1 as well as day 100," the company said.
On the container side of the cloud-native coin, .NET 8 streamlines containerization by simplifying the packaging of applications and bolstering security with default non-root user configurations. It also offers reduced image sizes for faster deployment and optional Chiseled Ubuntu images for enhanced security, alongside versatile architecture support.
Here, Microsoft pointed to various samples and reference templates that showcase patterns and practices
available to help devs get started.
Blazor has become a full-stack web-dev framework thanks to a rendering revamp led by Microsoft's Steve Sanderson, creator of Blazor, originally called "Blazor United." It provides for both client-side (Blazor WebAssembly) and server-side (Blazor Server), able to switch gears as conditions suggest.
ASP.NET product manager Daniel Roth earlier this year explained: "In .NET 8 we're expanding Blazor's capabilities so that it can handle all of your web UI needs, both client-side and server-side rendering. As part of this effort we're merging the existing Blazor Server and Blazor WebAssembly hosting models with new capabilities like stateless server-side rendering, streaming rendering, progressive enhancement for navigation & form handling, and the ability to interactivity per component using either Blazor or Blazor WebAssembly."
Today's announcement summarized all that: "With several new enhancements focused towards optimizing page load time, scalability, and elevating the user experience, developers can now use Blazor Server and Blazor WebAssembly in the same app, automatically shifting users from the server to the client at runtime. Your .NET code runs significantly faster on WebAssembly thanks to the new 'Jiterpreter' based runtime and new built in components. As a part enhancing the overall authentication, authorization, and identity management in .NET 8, Blazor now supports generating a full Blazor-based Identity UI."
.NET Multi-platform App UI extends the developer's toolbox, Microsoft says, offering a single-stack solution for building cross-platform mobile and desktop apps with .NET. The company dubbed it the "evolution" of Xamarin.Forms because it added desktop support to provide a unified development experience across Android, iOS, macOS and Windows, helping developers reach a wider audience.
In .NET 8, the framework extends its reach with additional support for the latest mobile OSes and sees improvements to performance, reliability and the developer experience.
".NET MAUI provides you a single project system and single codebase to build WinUI, Mac Catalyst, iOS, and Android applications," Microsoft said. "Native AOT (experimental) now supports targeting iOS-like platforms. A new Visual Studio Code extension for .NET MAUI gives you the tools you need to develop cross-platform .NET mobile and desktop apps. Xcode 15 and Android API 34 are now supported allowing you to target the latest version of iOS and Android. A plethora of quality improvements were made to the areas of performance, controls and UI elements, and platform-specific behavior, such as desktop interaction adding better click handling, keyboard listeners and more."
"You can now create primary constructors in any class and struct with a simple and elegant syntax," Microsoft said about new features in its flagship programming language. "No more boilerplate code to initialize your fields and properties. Be delighted when creating arrays, spans, and other collection types with a concise and expressive syntax. Use new default values for parameters in lambda expressions. No more overloading or null checks to handle optional arguments. You can even use the using alias directive to alias any type, not just named types!"
The company's "What's new in C# 12" guidance explains the following new C# features are in version 12:
That's a Wrap
There's a whole bunch of new features and functionality surrounding .NET 8, as Microsoft also announced Visual Studio 2022 17.8 has reached general availability. The company also pointed to its VS Code and C# Dev Kit to help newbies get started. Another way to get started, Microsoft said, is with the new GitHub Codespaces template for .NET, which comes in the SDK.
Today's announcement post also includes links to many more resources that help flesh out what's new in .NET 8 across ASP.NET Core, Entity Framework Core, NuGet, .NET Runtime, .NET SDK, WPF, ARM64, debugging and much more.
Microsoft packaged up highlights of the .NET Conf 2023 keynote presentation in a video.
David Ramel is an editor and writer for Converge360.