Repository navigation
Conversation
…rtyChanged only at runtime The property-changed factory decided at expression-build time whether to subscribe, based on whether the property's declaring type implements INotifyPropertyChanged. When the property is declared on a plain interface (or base type) and the target object implements INotifyPropertyChanged, no subscription was made and later changes were never observed. Check the target instance instead. Fixes reactivemarbles#1156 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1156.
ExpressionBuilder.CreatePropertyChangedFactorydecided when the expression was built whether to subscribe: it only did so if the property's declaring type implementsINotifyPropertyChanged. For a property declared on a plain interface (IHasPlainAge.Age),WhenValueChanged/WhenPropertyChangedtherefore never subscribed, even when the object at runtime implementsINotifyPropertyChanged, which is the scenario described in the issue.The factory now returns
Neveronly when the expression isn't a property access; otherwise it checkstarget is INotifyPropertyChangedper instance and subscribes through that.Behaviour change: subscriptions now happen for objects that implement
INotifyPropertyChangedat runtime even when the declared type in the expression doesn't. Every case that subscribed before still does (an instance of an INPC-declaring type is itself INPC); objects that don't implement INPC still getNever.Test.
PropertyIsDeclaredOnInterfaceWithoutNotification_ChangesAreStillObservedinWhenPropertyChangedFixture.UnitTests, next toExpressionContainsImplicitInterfaceCast, with supporting typesIHasPlainAgeandNotifyingChildModel. It fails without the change (no value change recorded) and passes with it.Ran (net9.0): the
WhenPropertyChangedFixturetests fail 1/43 before and pass after; the Binding/WhenPropertyChanged/WhenValueChanged/AutoRefresh tests pass (278). A fullDynamicData.Testsrun on net9.0 passed 2631 / 0 failed / 17 skipped. Only net9.0 was built and tested.This change was written with Claude Code.
🤖 Generated with Claude Code