News
Windows Community Toolkit v8.2 Adds Native AOT Support
Microsoft shipped Windows Community Toolkit v8.2, an incremental update to the open-source collection of helper functions and other resources designed to simplify the development of Windows applications. The main new feature is support for native ahead-of-time (AOT) compilation.
"The Windows Community Toolkit supports Native AOT for all platforms," said lead software engineer Michael Hawker in an April 2 announcement. "Compiling your C# app with AOT can help improve performance and memory usage."
Microsoft has been infusing Native AOT into its developer tooling for years, perhaps motivated by a 2020 survey that found its omission from the .NET ecosystem turned off many developers.
[Click on image for larger view.] "Does the lack of officially supported native AOT option prevent you from using .NET more?" (source: Microsoft).
Microsoft last August announced Native AOT support in a related offering, the .NET Community Toolkit, saying it provides these benefits:
-
Minimized disk footprint: When publishing using Native AOT, a single executable is produced containing just the code from external dependencies that is needed to support the program. Reduced executable size can lead to:
- Smaller container images, for example in containerized deployment scenarios.
- Reduced deployment time from smaller images.
-
Reduced startup time: Native AOT applications can show reduced start-up times, which means:
- The app is ready to service requests quicker.
- Improved deployment where container orchestrators need to manage transition from one version of the app to another.
- Reduced memory demand: Native AOT apps can have reduced memory demands, depending on the work done by the app. Reduced memory consumption can lead to greater deployment density and improved scalability.
However, while Native AOT can provide performance improvements in terms of faster startup times, reduced memory usage, and simplified deployment, it also introduces limitations, especially around flexibility, dynamic features, and platform compatibility. It's commonly viewed as an excellent choice for scenarios where performance is a critical concern and the application can be structured in a way that avoids relying on reflection and dynamic behavior. It may not be suitable for all applications, through, particularly those that require high flexibility or make extensive use of dynamic features.
In addition to Native AOT support, v8.2 of the Windows Community Toolkit includes a number of other relatively minor new features, improvements and fixes primarily driven by its community of supporting developers, including:
- UWP Support for .NET 9: The toolkit now supports Universal Windows Platform (UWP) applications built with the latest .NET 9 runtime, in addition to existing support for .NET Native.
- Enhanced SwitchConverter: A new
SwitchConverter
has been introduced to work with the SwitchPresenter
control. This allows for more flexible handling of content within the presenter, enabling easier conversion of general values to specific resources, such as binding an application status to a particular color.
- AcrylicBrush Re-enabled for WinUI 3: Developers using WinUI 3 can once again utilize the
AcrylicBrush
for creating visually appealing compositing effects within their applications.
- Improved DispatcherQueueTimer.Debounce: The extensions for
DispatcherQueueTimer.Debounce
have been enhanced with better handling of asynchronous scenarios and improved state management.
- Windows Community Toolkit Labs - New Experiments:
- DependencyPropertyGenerator: A new source generator simplifies the creation of Dependency Properties by using attributes, leveraging the partial properties feature in C# 13 to automatically generate boilerplate code.
- OpacityMaskView: This new
ContentControl
allows for complex brush compositing with transparency by acting as a wrapper around another element, enabling content behind it to be visible through an opacity mask.
"The Toolkit is part of the .NET Foundation," Hawker said. "You can download our Sample Gallery from the Microsoft Store to discover and try Toolkit components before getting started on your project. You can find an introduction video here."
About the Author
David Ramel is an editor and writer at Converge 360.