CommunityToolkit icon indicating copy to clipboard operation
CommunityToolkit copied to clipboard

ObservableProperty - property Attribute not recognized during code cleanup

Open TomOeser opened this issue 4 months ago • 0 comments

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_

TomOeser avatar Mar 06 '24 10:03 TomOeser