The .NET Foundation announced the release of the .NET Community Toolkit 8.3, bringing key updates including full support for .NET 8 and NativeAOT. This release enhances performance, contains some bug fixes, and provides new features aimed at improving the developer experience.
The primary highlight of the 8.3 release is the introduction of .NET 8 and NativeAOT support across all libraries. All APIs have been updated to be fully compatible with trimming and ahead-of-time (AOT) compilation, ensuring smooth integration even in these advanced scenarios. Additionally, new trim annotations provide warnings for potentially unsafe code.
There appeared a comment raising concerns about NativeAOT support, particularly with ObservableProperty:
I do not really understand the claim ‘NativeAOT support’ when you are showcasing a case where it is not supported and gives warnings.
In response, it was clarified that while ObservableProperty
may have limitations with NativeAOT, using AOT-compatible source generators is recommended. Reflection-based APIs are the ones that trigger warnings, and the toolkit now includes annotations to inform developers of these issues.
Additionally, the MVVM Toolkit now supports the net8.0-windows10.0.17763.0 target, enhancing compatibility with WinAppSDK (WinUI 3). This update ensures that necessary interop code is generated for types that might be marshalled to WinRT, enabling seamless usage of the MVVM Toolkit in .NET projects.
Performance improvements in this release focus on making the INotifyPropertyChanging
interface pay-for-play. Developers can disable this interface when it is not needed, eliminating unnecessary overhead. This is particularly useful in frameworks like UWP and WinUI 3, where viewmodels do not require this functionality. By setting a property in the .csproj file, the associated code is trimmed out, optimizing application performance.
Other notable fixes and improvements in this release include:
- A fix for the generation of
OnPropertyChanging
methods for dependent properties using[NotifyPropertyChangedFor]
. - A correction in the length calculation for the
IBufferWriterExtensions.Write
method for unmanaged types. - An adjustment in the offset calculation for
Memory2D<T>
instances created from aMemoryManager
. - A change to prevent the
ObservableValidator.HasError
property from auto-generating in table views.
The full changelog is available on the GitHub release page. The source code can be found on GitHub, with additional documentation provided on Microsoft Learn and the .NET API browser website. Contributions and feedback are encouraged to help shape future releases of the toolkit.