Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News What's New in .NET Community Toolkit v8.1.0 Preview 1

What's New in .NET Community Toolkit v8.1.0 Preview 1

Microsoft's .NET Community Toolkit's latest version, v.8.1.0, recently reached its first preview release. The release brings several new features and improvements to the toolkit, most notably improvements to the MVVM source generator performance and the addition of custom attributes support for the ObservableProperty attribute.

Version 8.1.0 also brings additional IMessenger extensions and .NET 7 and C# 11 support.

The toolkit now allows source generators to use Roslyn 4.3 in supported hosts. This addition enables the generators to use more optimised APIs introduced in the new version of Roslyn. Another newer Roslyn feature that improves performance is the usage of the ForAttributeWithMetadataName<T> attributes. This improves generators that target specific attributes such as the ObservableProperty attribute.

Diagnostics are now running out of process, independently from the source generator itself, which improves IntelliSense performance while typing code.

IObservable<T> extensions were added to the IMessenger interface, allowing developers to leverage Reactive-style APIs while using the interface. This extension has a simple API, but now it is no longer an API that users of the toolkit have to implement on their own every time they want to use IMessenger in a reactive way.

The HighPerformance package of the toolkit now uses the .NET 7 TFM, and the toolkit now uses the latest C# features, such as the usage of the new NullableRef<T> type, in places where generic out ref types are needed.

The Microsoft .NET Community Toolkit, a part of the .NET Foundation, is a UI platform-agnostic toolkit of helpers and APIs. It includes the CommunityToolkit.Common, CommunityToolkit.Mvvm, CommunityToolkit.Diagnostics and CommunityToolkit.HighPerformance libraries. Developers can use all the libraries with versions of .NET down to Standard 2.0, meaning they can also use it in .NET Framework projects.

Version 8.0, released on August 4 2022, introduced new source generators and changed the implementation of all generators to use incremental generation, which reduces the load of code generation on the IDE. Version 8.0 was also the first version of the toolkit to be separated from the Windows Community Toolkit, which is a more narrow toolkit, targeting specifically UWP applications and applications for Windows 10 and 11.

It is also the officially endorsed replacement for the now deprecated MvvmLight toolkit, which was widely used as a library of helpers for the MVVM development model. Microsoft provides an official migration guide for developers wanting to switch to the Community Toolkit.

A sample application using the toolkit is provided on the Microsoft Store. Additional information on the toolkit is available in the official documentation, the toolkit's GitHub repository, in a video from .NET Conf 2021, or by browsing through the .NET API browser.

About the Author

Rate this Article