Custom attributes for [RelayCommand], new property change hooks for [ObservableProperty] fields, MVVM code fixers, and MVVM source generator optimizations are also featured in the update. Microsoft has launched .NET Community Toolkit 8.2, again with improvements for MVVM (model-view-viewmodel) development. The preceding 8.1 release, published in January, also focused on MVVM capabilities. The .NET Community Toolkit features a collection of APIs and helpers for .NET developers, agnostic of any UI platform. Source code for version 8.2, announced April 27, can be accessed from GitHub. With the new release of .NET Community Toolkit, the included MVVM Toolkit now supports custom attributes when using [RelayCommand]. Developers can leverage the native field: and property: C# syntax to indicate targets of custom attributes, giving them full control over attributes for generated members when using [RelayCommand] to generate an MVVM command. Microsoft said support for custom attributes was particularly useful when using a viewmodel that needs to support JSON serialization and must explicitly ignore the generated property. Also in the MVVM Toolkit in 8.2, two new property change hooks now are generated for all [ObservableProperty] fields. This fixes a situation in which using [ObservableProperty] lacked the infrastructure to easily inject logic for state changes on old and new values being set. A common scenario in MVVM is to have a “selected item” observable property, representing, for example, the currently selected user or nested viewmodel. In previous versions, when the value of the property changed, it was not uncommon to also have to make some adjustments to old and new instances. The MVVM Toolkit in 8.2 also adds built-in code fixers for two previously added diagnostic analyzers. These analyzers produce a warning when incorrectly accessing a field marked with [ObservableProperty] and when declaring a type with [ObservableProperty] and similar attributes when using inheritance. The update also brings performance improvements to MVVM source generators, focused on optimizing incremental pipelines to minimize memory usage and ensure that no unnecessary objects will be kept alive across concurrent executions. In another improvement, all generated types and members now are decorated with full XML docs, making inspected code produced by the source generators easier to understand. With the .NET Community Toolkit 8.2 release, runtime performance has been improved as well. The .NET Community Toolkit includes these libraries: CommunityToolkit.Common CommunityToolkit.Mvvm (aka “Microsoft MVVM Toolkit”) CommunityToolkit.Diagnostics CommunityToolkit.HighPerformance These components are used in several inbox apps that ship with Windows, such as the Microsoft Store and the Photos app. Related content news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks how-to How to use DispatchProxy for AOP in .NET Core Take advantage of the DispatchProxy class in C# to implement aspect-oriented programming by creating proxies that dynamically intercept method calls. By Joydip Kanjilal Nov 14, 2024 7 mins Microsoft .NET C# Development Libraries and Frameworks news Microsoft’s .NET 9 arrives, with performance, cloud, and AI boosts Cloud-native apps, AI-enabled apps, ASP.NET Core, Aspire, Blazor, MAUI, C#, and F# all get boosts with the latest major rev of the .NET platform. By Paul Krill Nov 12, 2024 4 mins C# Generative AI Microsoft .NET feature Can Wasm replace containers? WebAssembly revolutionized browser apps, and promises to upend the server stack. How will it impact containers and Kubernetes? Six experts weigh in. By Bill Doerrfeld Nov 11, 2024 12 mins Containers Kubernetes Cloud Native Resources Videos