-
Notifications
You must be signed in to change notification settings - Fork 370
Labels
analyzer 👓A new analyzer being implemented or updatedA new analyzer being implemented or updatedmvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkit
Description
Describe the bug
MVVMTK0042 code fix does not work for fields with additional attributes (e.g. NotifyPropertyChangedFor)
Regression
No response
Steps to reproduce
Before MVVMTK0042 code fix:
public partial class Class1 : ObservableObject
{
[ObservableProperty, NotifyPropertyChangedFor(nameof(Age))] private string _name = String.Empty;
[ObservableProperty] private int _age;
}After MVVMTK0042 code fix is applied to the project:
public partial class Class1 : ObservableObject
{
[ObservableProperty, NotifyPropertyChangedFor(nameof(Age))] private string _name = String.Empty;
[ObservableProperty]
public partial int Age { get; set; }
}_name is not automatically converted to a public partial property along with _age.
Expected behavior
Fields with attributes in addition to [ObservableProperty] are automatically converted when the MVVMTK0042 code fix runs.
public partial class Class1 : ObservableObject
{
[ObservableProperty, NotifyPropertyChangedFor(nameof(Age))] public partial string Name { get; set; } = String.Empty;
[ObservableProperty] public partial int Age { get; set; }
}Screenshots
No response
IDE and version
VS 2022 Preview
IDE version
v17.13.0 Preview 1.0
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.4.0-preview2
Additional context
No response
Help us help you
No, just wanted to report this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzer 👓A new analyzer being implemented or updatedA new analyzer being implemented or updatedmvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkit