CommunityToolkit
CommunityToolkit copied to clipboard
ObservableProperty - property Attribute not recognized during code cleanup
Type of issue
Other (describe below)
Description
Added property attributes to ObservableProperty attribute is ignored while code cleanup. In this example the using directive for System.Text.Json.Serialization gets removed even when used as property attribute.
using System.Text.Json.Serialization;
using CommunityToolkit.Mvvm.ComponentModel;
partial class Example : ObservableObject
{
[ObservableProperty]
[property: JsonPropertyName("exampleProperty")]
private string _exampleProperty = string.Empty;
}
After performed clean up - on file save etc. for example
// using directive for System.Text.Json.Serialisation was removed
using CommunityToolkit.Mvvm.ComponentModel;
partial class Example : ObservableObject
{
[ObservableProperty]
[property: JsonPropertyName("exampleProperty")] // missing property "JsonPropertyName"
private string _exampleProperty = string.Empty;
}
### Page URL
None
### Content source URL
None
### Document Version Independent Id
None
### Article author
Tom Oeser
### Metadata
_No response_