What's New for Web, Data, Desktop and Mobile in .NET 9 Preview 4

Microsoft's newly shipped fourth preview of .NET 9 sees minor improvements across the framework's components, affecting developers for the web, desktop, mobile and data.

[Click on image for larger view.] .NET (source: Microsoft).

Spanning those components are the framework's libraries and runtime, where new work includes:

  • UnsafeAccessorAttribute supports generic parameters: This support allows unsafe access to type members previously inaccessible to the caller. Originally introduced in .NET 8 without generic parameter support, this enhancement was prioritized based on community feedback and is now available for CoreCLR and native AOT scenarios. Additional work, including support in mono, is ongoing and detailed here.
  • Feature switches with trimming support: This enables the definition of feature toggles in .NET libraries. The FeatureSwitchDefinitionAttribute treats feature switch properties as constants during trimming, allowing unused code to be removed. Similarly, FeatureGuardAttribute uses properties as guards for code requiring dynamic features, ensuring that unnecessary code is excluded during native ahead-of time (AOT) compilation. This ensures optimized performance by trimming out non-essential code based on the application's configuration.
  • Tokenizer library enhancements: Tokenizer overloads accept Span<char>, enhancing control over normalization and pre-tokenization. Additionally, a new CodeGen tokenizer supports models like codegen-350M-mono and phi-2, allowing for efficient encoding of text. These improvements are detailed here.
  • OpenTelemetry: Make activity linking more flexible -- The Activity.AddLink method enables the addition of links to an Activity object after its creation. This enhancement aligns .NET more closely with OpenTelemetry specifications, as previously, activity linking could only occur during the creation of an Activity object. This update provides greater flexibility in linking an Activity to other tracing contexts, facilitating better tracing and monitoring capabilities within applications. More info is here.
  • PDB support for System.Reflection.Emit.PersistedAssemblyBuilder: This support enables the emission of symbol information for debugging assemblies created with Reflection.Emit. The new APIs include methods for defining documents, marking sequence points, and setting local symbol information, closely mirroring the .NET Framework's functionality. These enhancements facilitate the generation of portable PDBs, improving the debugging experience for dynamically generated assemblies.

Summaries of other areas include:

.NET Data & EF Core
Full release notes are here, detailing:

Full release notes are here, detailing:

Full release notes are here, detailing:

Full release notes are here, detailing:

More information can be found in the newly updated What's new in .NET 9 documentation for the next iteration of the framework, due to debut in November.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube