Describe the bug
On main, the below code triggers MVVMTK0042. Then if you use the "Use a partial property" suggestion, the replacing partial property isn't required while the field was.
partial class Test : ObservableObject
{
[ObservableProperty] // MVVMTK0042 here
internal required string foo; // Applying MVVMTK0042's suggestion makes it public partial string Foo { get; set; }, removing required
}
Steps to reproduce
- Run
dotnet pack src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj (on the current main)
- Create a WPF App (.NET 8)
- Install the package generated by step 1
- Add
<LangVersion>preview</LangVersion> to the .csproj
- Create a class as follows:
using CommunityToolkit.Mvvm.ComponentModel;
namespace WpfApp1;
partial class Test : ObservableObject
{
[ObservableProperty]
internal required string foo;
}
- Apply the suggestion to fix MVVMTK0042 that happens on the above [ObservableProperty]
Expected behavior
After applying the suggestion, internal required string foo; becomes public required partial string Foo { get; set; } instead of public partial string Foo { get; set; }
IDE and version
VS 2022 Preview
IDE version
17.12.0 Preview 4.0
Nuget packages
Nuget package version(s)
8.4.0-build.15
Help us help you
Yes, but only if others can assist
Describe the bug
On main, the below code triggers MVVMTK0042. Then if you use the "Use a partial property" suggestion, the replacing partial property isn't required while the field was.
Steps to reproduce
dotnet pack src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj(on the current main)<LangVersion>preview</LangVersion>to the .csprojExpected behavior
After applying the suggestion,
internal required string foo;becomespublic required partial string Foo { get; set; }instead ofpublic partial string Foo { get; set; }IDE and version
VS 2022 Preview
IDE version
17.12.0 Preview 4.0
Nuget packages
Nuget package version(s)
8.4.0-build.15
Help us help you
Yes, but only if others can assist