Microsoft has released the latest version of .NET Community Toolkit 8.2, with several new enhancements and features, Infoq reports. The new release comes with a number of performance improvements to both the runtime and MVVM Toolkit source data generators, new code fixes aimed at boosting performance, and a number of features requested by users.
The first addition to the MVVM Toolkit is support for custom attributes with RelayCommand. This was suggested by users on GitHub and builds on work done in the previous release.
The new version leverages the native field: and property: C# syntax to indicate targets of custom attributes, giving users full control over attributes for all generated members when using RelayCommand to generate an MVVM command.
In 8.2 of the toolkit, developers can use two new hooks to modify properties that have been added to the ObservableProperty fields. These are intended to handle a common scenario in MVVM where an observable property, such as “selected item”, needs to be changed, requiring changes to both old and new instances.
With ObservableProperty, developers can ensure that the selected view model will always be correctly reported as selected. MVVM Toolkit is also optimized to automatically detect the use of this attribute, which optimizes code generation. In addition, the latest version of the toolkit includes built-in code fixers for these two analyzers. According to the report, users now have the option to fix their code by selecting the code fix suggested by the IntelliSense light when the analyzers issue a warning.
The new version also brings some performance improvements to the MVVM Toolkit generators. The main focus is on optimizing incremental pipelines to minimize memory usage and ensure that no unnecessary objects are maintained in concurrent executions. The other is removing some Roslyn symbols from the incremental pipeline and enabling the required analyzer symbols at the beginning during the initial feedback setup. The purpose of the latter is to speed up the feedback executions in each compilation instance.