|.NET Community Toolkit 8.2 Adds Faster Generators|
|Written by Kay Ewbank|
|Monday, 15 May 2023|
Microsoft has announced version 8.2 of the .NET Community Toolkit, a collection of helpers and APIs that work for all .NET developers. The developers say this new version includes performance improvements both at runtime and in the MVVM Toolkit source generators, and new code fixers to enhance your productivity.
The Community Toolkit is UI platform agnostic. While it is maintained and published by Microsoft, and is part of the .NET Foundation, it can be used by application developers regardless of the specific UI framework in use.
The toolkit is made up of libraries that were originally part of the Windows Community Toolkit that Microsoft released to simplify building UWP and .NET apps for Windows 10 and Windows 11.
The performance improvements in the toolkit's source generators come from optimizations to the incremental pipelines to minimize memory use and ensure no unnecessary objects are kept alive across concurrent executions. To achieve this, two more diagnostics in the MVVM Toolkit have been moved to a diagnostic analyzer, which can run concurrently and out of process. This removes some Roslyn symbols from the incremental pipeline and improves the overall generator performance.
This release includes support for custom attributes when using [RelayCommand]. The team says this is particularly useful when using a viewmodel that needs to support JSON serialization, and you need to explicitly ignore the generated property.
Another improvement is the ability to change hooks for an observable property. This improves the situation when you have a selected item" observable property, such as the currently selected user, or nested viewmodel. When the value of this property changes, it was until now difficult to make adjustments to the old and new instances as [ObservableProperty] didn't have the necessary infrastructure. It now does.
The other change of note isthe addition of MVVM Toolkit code fixers. These extend the diagnostic observable property analyzers added in the previous release to go beyond producing a warning to suggesting built-in code fixes. Hovering on the IntelliSense light bulb now shows a suggested code fix that can be automatically applied, including bulk fixes, so you can fix all of your errors with a single click.
.NET Community Toolkit is available now on GitHub.
or email your comment to: email@example.com
|Last Updated ( Monday, 15 May 2023 )|