-
-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Describe the bug 🐞
When creating partial properties with Reactive or ObservableAsProperty attribute in a class which is subclass of ReactiveObject the RXUISG0016 analyzer flags these properties and suggests to convert them to Reactive field.
Even for the property using the ObservableAsProperty attribute it suggests to convert it to a field with the Reactive attribute instead of ObservableAsProperty attribute.
Step to reproduce
- Create a new .NET9 class library project
- Install the ReactiveUI and ReactiveUI.SourceGenerators packages
- Write a simple partial class which is a subclass of ReactiveObject
- Add a partial get-only property with [ObservableAsProperty] attribute and another partial property (get + set) with [Reactive] attribute
public partial class TestClass : ReactiveObject
{
[ObservableAsProperty]
public partial int TestObservableValue { get; }
[Reactive]
public partial int TestValue { get; set; }
}- See that the
TestObservableValueandTestValueproperties are flagged with RXUISG0016 suggesting to change them to Reactive fields.
Reproduction repository
https://github.com/DarkCloud14/ReactiveUI_AnalyzerIssues
Expected behavior
The RXUISG0016 analyzer should not flag partial properties if they have the Reactive or ObservableAsProperty attribute (IMHO the last one is even wrong or at least using the suggested code fix produces not the code you'd expect).
In addition to this maybe the ReactiveUI analyzer or ReactiveUI.SourceGenerators could flag (or throw an error) standard properties which have the Reactive or ObservableAsProperty attribute as I think nothing will be created from the SourceGenerators and such properties won't work as expected?!
Screenshots 🖼️
No response
IDE
Rider macOS
Operating system
macOS Sequoia 15.3.1
Version
No response
Device
No response
ReactiveUI Version
ReactiveUI 20.1.63, ReactiveUI.SourceGenerators 2.1.1
Additional information ℹ️
No response