Exploring what's new in .NET 9

Delving into the latest features in .NET 9 and your key takeaways

18/09/2024
Dominic Sinclair-Moore
FOUNDER
Dominic profile picture
Code tag

Introduction

In the dynamic world of software development, .NET continues to evolve, and with .NET 9, we’re stepping into a new era. This release isn’t just an incremental update; it’s a comprehensive reinforcement of the .NET framework’s foundational commitment to performance, cross-platform compatibility, security, and developer enrichment. Let’s dive into the exciting features and benefits that .NET 9 brings to the table.

Versatile Performance and Security Upgrades

The .NET 9 Runtime

  • Feature Switch Attributes: .NET 9 introduces a new attribute model for feature switches with trimming support. These attributes allow libraries to define feature switches, toggling specific areas of functionality dynamically. Whether you’re gradually rolling out new features or selectively enabling functionality based on runtime conditions, these switches empower developers.
  • Dynamic Garbage Collection Adaptation: Say goodbye to Server GC! The .NET 9 runtime adapts garbage collection strategies dynamically based on your application’s size. This ensures efficient memory management, especially in microservices and serverless environments.
  • Performance Boosts: Loop optimisations, inlining, Arm64 vectorization, and code generation—all contribute to faster execution. Whether you’re building high-throughput services or scientific simulations, .NET 9 has your back.

Enriching Libraries and LINQ Magic

System.Text.Json and LINQ Enhancements

  • Customizable JSON Serialization: System.Text.Json now lets you tweak indentation and other serialization options. Tailor your JSON output for APIs and web applications.
  • CountBy and AggregateBy: These new LINQ methods allow you to aggregate state by key without allocating intermediate groupings via GroupBy. Simplify your data processing code.

Cryptography and Reflection

  • One-Shot Hash Methods: .NET 9 adds a new one-shot hash method on the CryptographicOperations type. Secure your data efficiently.
  • PersistedAssemblyBuilder: Save emitted assemblies with PDB support. Debug generated assemblies confidently.

The .NET Aspire Stack for Cloud-Native Development

Workload Sets and Parallel Testing

  • Workload Sets: Keep your workloads at specific versions until explicitly updated. No surprises during updates!
  • Parallel Unit Testing: Run tests concurrently with better MSBuild integration. Faster feedback for developers.

NuGet Security and Terminal Logger

  • NuGet Audits: Security audits now cover both direct and transitive package references.
  • Terminal Logger: Enabled by default, with improved usability. Get a clear summary of failures and warnings during builds.

Conclusion

.NET 9 empowers developers to build robust, modern applications. Whether you’re diving into cloud-native development, optimizing performance, or enhancing security, embrace the power of .NET 9. Happy coding! 🚀🔥

Unlock the full potential of .NET 9 by checking out the documentation and getting started. What's new in .NET 9 | Microsoft Learn

Recent blog posts

a black and white photo of a street light
How AI-Powered Digital Transformation Shapes Architects and Developers
Read more
Visual Studio screen for Azure functions with Franklin from GTA quoting "Ah nooo, here we go again"
The journey to the swagger page with Docker, Azure Functions and .NET 7.0
Read more
Durable function illustration with Azure function icon
Durable Functions and when to use them
Read more

At dotnet, we blend innovation, creativity, and technology to craft transformative digital solutions. From consultancy and engineering to data analytics, cloud hosting, and innovation, we offer a spectrum of services. Partner with us and embark on a journey of digital excellence.

What we do
  • Services
  • Work

© 2024 dotnet. All rights reserved.