Exploring What’s New in .NET 8

In the early days of the .NET Framework, releases were infrequent and timed with Windows releases. The shift to an open-source platform brought a welcome change. Now, we anticipate an annual .NET release tied to the .NET Conf event every November.

Building on the foundation of .NET 7, this release introduces a host of new features. Understanding how your existing code adapts to this new version is crucial, and as experts in .NET, we wanted to guide you through some of the key features and changes we’re most excited about in .NET 8.

.NET 8: The Next LTS Release

The tick-tock pattern of STS (Standard Term Support) and LTS (Long Term Support) releases ensures a predictable support lifecycle for your projects. This release is the newest LTS version of .NET, meaning .NET 8 will have full support over the next two years.

This makes .NET 8 a great choice as an upgrade target for your existing applications, as well as a solid foundation for your new projects. You can benefit from the latest features and enhancements of .NET 8 without worrying about breaking changes or compatibility issues.

C# 12 Changes

Microsoft’s commitment to keeping things fresh is evident in the many changes to its most popular .NET language, C#. Here are a few changes of note:

  • Primary constructors are no longer restricted to record types, allowing their use in any class or struct.
  • Collection expressions bring a concise syntax for creating common collection values, supporting various collection-like types.
  • The introduction of ref readonly parameters adds clarity for APIs using ref or in parameters.
  • Default lambda parameters allow for default values in lambda expressions, similar to regular methods.
  • The ability to alias any type, not just named types, provides semantic aliases for various unsafe types.
  • Inline arrays, primarily used for performance optimization, enable fixed-size arrays within struct types.
  • Finally, the introduction of the experimental attribute and interceptors, though still in preview, offer ways to modify code behavior at compile time. (Please note that interceptors are an experimental feature and are recommended for experimentation purposes only, not for production applications.)

For more detailed information on each feature, refer to the C# 12 release notes.

Revolutionizing Memory Management

For those immersed in building .NET code for cloud-native applications, a game-changing API awaits. Now, you have the power to dynamically adjust the memory limit for an application using the .NET garbage collector. This enables seamless scaling of app resource consumption based on demand, optimizing costs, and efficiency.

Elevating JSON Serialization

Managing JSON serialization and deserialization in .NET has been elevated to a new level in .NET 8, particularly with upgrades to System.Text.Json.

This library provides fast and easy serialization and deserialization of JSON data, with built-in support for additional types, such as Half, Int128, UInt128, Memory<T>, and ReadOnlyMemory<T>. It also supports customizing the handling of members that are not in the JSON payload, interface hierarchies, naming policies, read-only properties, and more. These upgrades align closely with modern hardware, making them invaluable for machine learning models and GPU computing tools.

.NET Is So Random!

Updates in .NET 8 empower you with new tools for randomness. This isn’t just about random number generation; it’s a direct way to use randomness as a selector in your code. The tooling allows for the seamless selection and shuffling of items in a set of data, a game-changer for machine learning applications.

Security and Performance in Focus

.NET 8 introduces support for SHA-3 as an alternative to SHA-2, bolstering hashing capabilities. Additionally, improved security features enhance privacy in connections, addressing web proxies over HTTPS.

As always, .NET 8 offers a huge step up in performance, just by retargeting your existing code.

One notable performance enhancement in .NET 8 is more support for native AOT (ahead-of-time) compilation. This means that you can compile your .NET code directly to native code, without relying on a runtime or an interpreter. This results in faster startup times, lower memory usage, and better performance. Improvements to AOT in .NET 8 include:

  1. Support for the x64 and Arm64 architectures on macOS.
  2. Reduction in the sizes of Native AOT apps on Linux, with potential size reductions of up to 50%. For example, a “Hello World” app on Linux x64 can now be as small as 1.84 MB compared to 3.76 MB in .NET 7, with certain optimizations.
  3. The ability to specify an optimization preference, focusing on either size or speed. By default, the compiler aims for fast code while considering application size. However, users can use the <OptimizationPreference> MSBuild property to prioritize one over the other.

ASP.NET Core 8

There are too many changes coming in ASP.NET Core 8 to mention them all here, so here are some details about some of the changes coming to Blazor and SignalR:

Blazor Changes

In .NET 8, Blazor has become a full-stack web UI framework, capable of rendering content at both component and page levels. It offers various rendering modes, including static server rendering, interactive server rendering, and client rendering using Blazor Server and Blazor WebAssembly. The framework also introduces a new Blazor Web App template, combining the strengths of Blazor Server and Blazor WebAssembly.

Other improvements include enhanced form handling, streamlined navigation, streaming rendering for improved user experience, and support for injecting keyed services. Blazor now allows access to HttpContext as a cascading parameter and enables rendering Razor components outside of the ASP.NET Core environment. Additionally, there are performance enhancements, error handling improvements, and added support for Content Security Policy (CSP) compatibility. Blazor Identity UI has been integrated to facilitate user authentication.

SignalR Changes

In .NET Core 8.0, a new approach has been introduced to set server timeouts and Keep-Alive intervals directly on HubConnectionBuilder. The default values are 30 seconds for ServerTimeout and 15 seconds for KeepAliveInterval.

For JavaScript clients in ASP.NET Core 8.0 or later, you can use the withServerTimeoutInMilliseconds and withKeepAliveIntervalInMilliseconds methods when building a connection with HubConnectionBuilder. This is a departure from the previous approach in ASP.NET Core 7.0 or earlier.

For JavaScript clients of a Blazor Server app, the new approach involves using withServerTimeout and withKeepAliveInterval for Blazor Web Apps and Blazor Server. Similarly, .NET clients can now utilize WithServerTimeout and WithKeepAliveInterval methods.

Additionally, a new feature called SignalR stateful reconnect has been introduced to reduce downtime for clients facing temporary network disconnects. This works by temporarily buffering data on both the server and client, acknowledging received messages, and replaying any missed messages upon reconnection.

Ready for .NET 8?

If you are interested in upgrading your applications to .NET 8, or if you want to start a new project with this amazing platform, the team at Trailhead is here to help. We’ve been pioneers in the .NET ecosystem from the very beginning. With our expertise, we’re ready to assist you in upgrading to .NET 8 or embarking on new projects with confidence.

Contact us today to get started on this journey together!

Related Blog Posts

We hope you’ve found this to be helpful and are walking away with some new, useful insights. If you want to learn more, here are a couple of related articles that others also usually find to be interesting:

Manage Your Windows Applications With Winget

Winget, Microsoft’s native package manager for Windows 10 (version 1709 and later) and Windows 11, offers a streamlined CLI for efficient application management. This blog post introduces Winget’s installation and basic commands for installing, updating, and removing software. It highlights the tool’s ability to manage non-Winget-installed apps and explores curated package lists for batch installations. The post also recommends top Winget packages, noting some may require a paid subscription.

Read More

Our Gear Is Packed and We're Excited to Explore With You

Ready to come with us? 

Together, we can map your company’s software journey and start down the right trails. If you’re set to take the first step, simply fill out our contact form. We’ll be in touch quickly – and you’ll have a partner who is ready to help your company take the next step on its software journey. 

We can’t wait to hear from you! 

Main Contact

This field is for validation purposes and should be left unchanged.

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the form below. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Montage Portal

Montage Furniture Services provides furniture protection plans and claims processing services to a wide selection of furniture retailers and consumers.

Project Background

Montage was looking to build a new web portal for both Retailers and Consumers, which would integrate with Dynamics CRM and other legacy systems. The portal needed to be multi tenant and support branding and configuration for different Retailers. Trailhead architected the new Montage Platform, including the Portal and all of it’s back end integrations, did the UI/UX and then delivered the new system, along with enhancements to DevOps and processes.

Logistics

We’ve logged countless miles exploring the tech world. In doing so, we gained the experience that enables us to deliver your unique software and systems architecture needs. Our team of seasoned tech vets can provide you with:

Custom App and Software Development

We collaborate with you throughout the entire process because your customized tech should fit your needs, not just those of other clients.

Cloud and Mobile Applications

The modern world demands versatile technology, and this is exactly what your mobile and cloud-based apps will give you.

User Experience and Interface (UX/UI) Design

We want your end users to have optimal experiences with tech that is highly intuitive and responsive.

DevOps

This combination of Agile software development and IT operations provides you with high-quality software at reduced cost, time, and risk.

Trailhead stepped into a challenging project – building our new web architecture and redeveloping our portals at the same time the business was migrating from a legacy system to our new CRM solution. They were able to not only significantly improve our web development architecture but our development and deployment processes as well as the functionality and performance of our portals. The feedback from customers has been overwhelmingly positive. Trailhead has proven themselves to be a valuable partner.

– BOB DOERKSEN, Vice President of Technology Services
at Montage Furniture Services

Technologies Used

When you hit the trails, it is essential to bring appropriate gear. The same holds true for your digital technology needs. That’s why Trailhead builds custom solutions on trusted platforms like .NET, Angular, React, and Xamarin.

Expertise

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

  • Project Management
  • Architecture
  • Web App Development
  • Cloud Development
  • DevOps
  • Process Improvements
  • Legacy System Integration
  • UI Design
  • Manual QA
  • Back end/API/Database development

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

Our Gear Is Packed and We're Excited to Explore with You

Ready to come with us? 

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the contact form. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Thank you for reaching out.

You’ll be getting an email from our team shortly. If you need immediate assistance, please call (616) 371-1037.