You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: HasErrors is incorrect when performing a side effect from WhenAnyPropertyChanged #515
[Reactive]
public double MaxValue { get; set; }
[Reactive]
public double MinValue { get; set; }
If I were to have the above code (code weaved to be a notify property at build time) and I were to write:
var minMaxObs = this.WhenAnyValue(v => v.MinValue, v => v.MaxValue,
(min, max) => min < max)
this.ValidationRule(v => v.MaxValue, minMaxObs,
"Value must be less than max value.");
this.WhenAnyPropertyChanged("MaxValue").Subscribe(_ => {
// save to database here
});
Then when inside my subscribe callback HasErrors is false when a validation error has occurred. It seems like the state of HasErrors is behind one, because if the property is updated again and still invalid, HasErrors will be true.
I've tried re-ordering my observables so that validation rules were last, that didn't work.
EDIT:
This seems to be caused by WhenAnyPropertyChanged being called before WhenAnyValue, even though the order that subscribers are set up are right. This may be an upstream issue. A workaround I found is dispatching on the UI thread the subscription of the 'WhenAnyPropertyChanged' callback. I'm using WhenAnyPropertyChanged because I have a framework I created where properties marked with a specified attribute automatically save changes to the database, without requiring me to make observables for all of them.
Step to reproduce
Create a notifiable property and subscribe to changes via ReactiveUI WhenAnyPropertyChanged extension. Notice that validation status is wrong within subscription callback.
changed the title [-][Bug]: HasErrors is incorrect when performing a side effect from a property change event[/-][+][Bug]: HasErrors is incorrect when performing a side effect from WhenAnyPropertyChanged[/+]on Mar 15, 2023
Activity
[-][Bug]: HasErrors is incorrect when performing a side effect from a property change event[/-][+][Bug]: HasErrors is incorrect when performing a side effect from WhenAnyPropertyChanged[/+]- Add regression tests for ObjectDisposedException on disposal (#665)
fix: add regression tests for #515 and #665 (#879)
github-actions commentedon Mar 15, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.