docs/en/Community-Articles/2024-01-15-Abp-Supports-NET8/Post.md
Recently we have published ABP v8.0. With this version the ABP Framework and ABP Commercial both supports for .NET 8, aligning itself with the latest enhancements and new features of the ASP.NET's new version 8.
Here's the related PR for this upgrade. This update ensures that developers using ABP can leverage the new features and improvements of .NET 8, enhancing the capability and performance of their applications. With .NET 8 support, ABP 8.0 likely offers improved performance, enhanced security, and greater efficiency, making it a robust choice for building modern web applications. Here's the summary of .NET 8 features and enhancements:
.NET Aspire is a tool to observe and manage distributed web applications. It's still preview version. You can manage your containers, executables, logs, traces and metrics of your running web application. For more information see this article https://devblogs.microsoft.com/dotnet/introducing-dotnet-aspire-simplifying-cloud-native-development-with-dotnet-8/
12 features have been implemented for System.Text.Json serialization and deserialization library with .NET 8. See these enhancements
You may mock time in test scenarios with the new TimeProvider class and ITimer interface, which add time abstraction functionality.
The new IUtf8SpanFormattable interface targets UTF8 and Span<byte> instead of UTF16 and Span<char>. Also the new Utf8.TryWrite methods provide a UTF8 based counterpart to the existing MemoryExtensions.TryWrite methods, which are UTF16-based.
There are new validation attributes for cloud-native services. The new properties were added to the RangeAttribute and RequiredAttribute types. See the list below for the new validation attributes:
| New Data Attribute | Description |
|---|---|
| MinimumIsExclusive, MaximumIsExclusive | Checks whether bounds are included in the allowable range |
| Length | Checks both lower and upper bounds for strings or collections. For example, [Length(5, 10)] requires at least 5 elements and at most 10 elements in a collection |
| Base64String | Checks that a string is a valid Base64 format |
| AllowedValues, DeniedValues | Checks if values are from the allowed or disallowed list eg: [AllowedValues("man", "woman", "child")] |
The System.Random and System.Security.Cryptography.RandomNumberGenerator types present 2 new approaches to handling randomness.
The System.Numerics and System.Runtime.Intrinsics namespaces introduces some hardware improvements with .NET 8. The following structs reimplemented for running with the best performance on ARM64.
Vector256, Matrix3x2, and Matrix4x4 have improved
New APIs let you attach key-value pair tags to Meter and Instrument objects when you create them. Aggregators of published metric measurements can use the tags to differentiate the aggregated values.
SHA-3 (Secure Hash Algorithm 3) is the latest member of the Secure Hash Algorithm family of standards. With .NET 8 SHA-3 is being supported.
Before HttpClient allows hackers to make man-in-the-middle attack with .NET 8, it creates an encrypted channel between the client and the proxy so all requests can be handled with full privacy.
The new ZipFile.ExtractToDirectory provides a stream containing a zipped file and extract its contents into the filesystem.
Hosted services now have more options for execution during the application lifecycle. IHostedService provided StartAsync and StopAsync, and now IHostedLifecycleService provides these additional methods:
The option to publish as Native AOT was first introduced in .NET 7. Publishing an app with Native AOT creates a fully self-contained version of your app that doesn't need a runtime—everything is included in a single file. .NET 8 brings the following improvements to Native AOT publishing:
| Operating system | .NET 7 | .NET 8 |
|---|---|---|
Linux x64 (with -p:StripSymbols=true) | 3.76 MB | 1.84 MB |
| Windows x64 | 2.85 MB | 1.77 MB |
.NET 8 starts the work to enable Native AOT support for iOS-like platforms. You can now build and run .NET iOS and .NET MAUI applications with Native AOT on the following platforms:
iosiossimulatormaccatalysttvostvossimulator.NET 8 includes improvements to code generation and just-in time (JIT) compilation:
This section contains the following subtopics:
As part of an effort to improve containerization performance, new ASP.NET Docker images are available that have a composite version of the runtime. This composite is built by compiling multiple MSIL assemblies into a single ready-to-run (R2R) output binary. Because these assemblies are embedded into a single image, jitting takes less time, and the startup performance of apps improves. The other big advantage of the composite over the regular ASP.NET image is that the composite images have a smaller size on disk.
.NET 8 includes a new source generator that supports interoperating with COM interfaces.
The minimum support baselines for Linux have been updated for .NET 8. .NET is built targeting Ubuntu 16.04, for all architectures.
To decrease app size, .NET and .NET MAUI apps that target Android use profiled ahead-of-time (AOT) compilation mode when they're built in Release mode. Profiled AOT compilation affects fewer methods than regular AOT compilation. .NET 8 introduces the <AndroidStripILAfterAOT> property that lets you opt-in to further AOT compilation for Android apps to decrease app size even more.
.NET 8 includes several new code analyzers and fixers to help verify that you're using .NET library APIs correctly and efficiently. The following table summarizes the new analyzers.
Starting in .NET 8, NuGet verifies signed packages on Linux by default. NuGet continues to verify signed packages on Windows as well.
Starting in .NET 8, C# Hot Reload supports modifying generic types and generic methods. When you debug console, desktop, mobile, or WebAssembly applications with Visual Studio, you can apply changes to generic classes and generic methods in C# code or Razor pages. For more information, see the full list of edits supported by Roslyn
References: