Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObservableProperty - property Attribute not recognized during code cleanup #383

Open
TomOeser opened this issue Mar 6, 2024 · 0 comments
Labels

Comments

@TomOeser
Copy link

TomOeser commented Mar 6, 2024

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_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant