.NET Community Toolkit 8.2.1

Devblogs Microsoft are thrilled to announce the highly anticipated release of .NET Community Toolkit 8.2.1! Packed with quality-of-life improvements, performance optimizations, new code fixers, and enhanced diagnostics, this update takes your development capabilities to the next level. We extend our heartfelt gratitude to the community members whose invaluable feedback helped shape this release. Your continuous contributions empower us to make the .NET Community Toolkit better with each iteration. Let's dive into the exciting features and enhancements of this new version! 

A Comprehensive Toolkit: The .NET Community Toolkit comprises the following libraries: 

CommunityToolkit.Mvvm (also known as "Microsoft MVVM Toolkit") 

For a detailed overview of the .NET Community Toolkit's evolution, refer to our previous announcement post for version 8.0.0. Now, let's explore the key changes and improvements that await you in the 8.2.1 release. 

New Analyzer and Code Fixer for [RelayCommand]: The [RelayCommand] attribute, capable of handling asynchronous methods, brings convenience and efficiency to your code. However, developers often overlooked this functionality and resorted to using async void methods instead. Consequently, they missed out on the additional benefits offered by async commands, such as progress reporting and concurrency control. 

To address this, the MVVM Toolkit in version 8.2.1 introduces a new analyzer. It generates diagnostics for async void methods annotated with [Relay Command]. Accompanying this feature is a code fixer that simplifies the process. With just a click of the lightbulb icon, Roslyn automatically refactors your code, making the necessary adjustments. The code fixer also adds any required using statements at the top of your file, ensuring a seamless experience. Additionally, you can easily apply this code fixer to multiple locations within your project or solution. 

Other Changes and Improvements: In addition to the enhancements, the .NET Community Toolkit 8.2.1 brings several other changes and improvements, including: 

1. Fix for an access violation when indexing a sliced Memory2D<T> instance: An issue causing access violations when indexing elements after slicing a Memory2D<T> instance has been resolved. Special thanks to Mahalex for reporting this. 

2. Fix for forwarding attributes with negative enum values: Enum members with negative values will no longer cause problems with the MVVM Toolkit generators for generated observable properties. We appreciate n-coelho-cerinnov for bringing this to our attention. 

3. Improved handling of invalid attribute forwarding: The generator now gracefully handles attempts to forward attributes that are not referenced correctly, providing clear error messages for easy troubleshooting. 

4. Enhanced Observable Validator generator: The generator for property validation now correctly detects properties from base types for the target view model. This improvement resolves the issue raised by Dgellow. 

5. Warning for MVVM Toolkit usage with packages.config: Users employing the MVVM Toolkit from a project utilizing packages.config will now receive clear warning messages explaining the limitation and encouraging the use of <PackageReference>. Thanks to Smaugbend for reporting this. 

6. Optimizations for responsiveness: By checking for cancellations more frequently in generators, the IDE responsiveness when using the MVVM Toolkit is noticeably improved. 

7. Memory optimization in MVVM Toolkit source generators: The MVVM Toolkit source generators have undergone memory optimizations, resulting in more efficient resource allocation. 

8. Handling of [ObservableProperty] fields with keyword identifiers: The generator now correctly handles fields annotated with [ObservableProperty] that use escaped keyword identifiers in the source code. Our gratitude to Get0457 for highlighting this issue. 

The release of .NET Community Toolkit 8.2.1 amplifies your development experience, providing you with an array of improvements and enhancements. Whether you're leveraging the new analyzer and code fixer for [RelayCommand], benefiting from the optimized performance, or exploring the numerous fixes across the libraries, this update equips you with the tools to streamline your development workflow. We invite you to embrace the power of the .NET Community Toolkit 8.2.1 and take your applications to new heights. 

Comments 0



Schedule A Custom 20 Min Consultation

Contact us today to schedule a free, 20-minute call to learn how DotNet Expert Solutions can help you revolutionize the way your company conducts business.

Schedule Meeting paperplane.webp