Describe the bug 🐞
Source Generator for nullable partial ObservableAsProperty emits code that won't allow value to be updated with null value; while the last non-null value remains.
Step to reproduce
Property:
[ObservableAsProperty]
public partial string? Test { get; }
Generated Code:
private string? _test;
private readonly ReactiveUI.ObservableAsPropertyHelper<string?> _testHelper;
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public partial string? Test { get => _test = _testHelper?.Value ?? _test; }
In above case value is updated and .ToProperty is called with null value; value is not updated and previous non-null value remains.
Reproduction repository
https://github.com/reactiveui/ReactiveUI
Expected behavior
Expected code generation for nullable property should be:
private string? _test;
private readonly ReactiveUI.ObservableAsPropertyHelper<string?> _testHelper;
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public partial string? Test { get => _test = _testHelper?.Value; }
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows
Version
2.1.8
Device
No response
ReactiveUI Version
20.1.63
Additional information ℹ️
The above provided bug may not evet be a bug but expected behaviour. I encountered it while developing my application and property was behaving unexpectedly while being updated with null value.
Describe the bug 🐞
Source Generator for nullable partial ObservableAsProperty emits code that won't allow value to be updated with null value; while the last non-null value remains.
Step to reproduce
Property:
Generated Code:
In above case value is updated and
.ToPropertyis called withnullvalue; value is not updated and previous non-null value remains.Reproduction repository
https://github.com/reactiveui/ReactiveUI
Expected behavior
Expected code generation for nullable property should be:
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows
Version
2.1.8
Device
No response
ReactiveUI Version
20.1.63
Additional information ℹ️
The above provided bug may not evet be a bug but expected behaviour. I encountered it while developing my application and property was behaving unexpectedly while being updated with
nullvalue.