Skip to content

[Bug]: WhenPropertyChanged() does not recognize INotifyPropertyChanged when casting is involved. #1156

Description

@JakenVeina

The current implementation of WhenPropertyChangedBehaviorFixture.ExpressionContainsImplicitInterfaceCast() has 99% of this scenario. In fact, writing it is how I noticed this scenario.

If INotifyPropertyChanged is removed from IHasAge and moved down to ChildModel, then the test stops working. The .WhenPropertyChanged() operator seems to only be looking at an object's interpreted type within the expression to see if it has INotifyPropertyChanged compatibility. I.E. if the expression itself doesn't report INotifyPropertyChanged compatibility at compile-time, then the operator doesn't recognize it.

Since INotifyPropertyChanged subscriptions take place at runtime, rather than expression-compile-time, it should be entirely possible to check for compatibility on each object instance, immediately before a subscription would occur. I've got no idea how easy this will be to implement within the existing system, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions