Skip to content

[Bug]: Numeric conversions in observed property chains are discarded #1177

Description

@dwcullop

Please note we can't commit to any timeline.

Describe the bug 🐞

ExpressionBuilder treats every Convert step as identity. For an observable double Amount, WhenValueChanged(x => ((decimal)x.Amount).Scale) consequently passes a boxed double to a property declared on decimal, and reports TargetException. The final compiled accessor cannot repair the preceding subscription/navigation walk.

Step to reproduce

Create an INotifyPropertyChanged model with a double Amount. Observe the decimal Scale property through an explicit numeric conversion, then change Amount. Exercise initial notifications both enabled and disabled.

Regression tests/checks:

NumericConversionBeforePropertyAccess_InitialValue_IsObserved; NumericConversionBeforePropertyAccess_PropertyChanges_AreObserved

Reproduction repository

https://github.com/reactivemarbles/DynamicData/tree/85ee49cfd54d8782c36ed137886d318e942345c4

Regression tests and fixes:
https://github.com/reactivemarbles/DynamicData/tree/u/dacullop/main/pr-1165-review

Expected behavior

The conversion must be evaluated before subsequent property access, and the resulting values and later notifications must be delivered. Reference and interface casts must continue to work.

Screenshots 🖼️

N/A.

IDE

N/A; command-line reproduction.

Operating system

Windows.

Version

.NET SDK 10.0.401; net9.0 test target.

Device

N/A.

DynamicData Version

Main 10.0-preview at 85ee49c. The related 9.5 candidate is PR #1165 at 3d76872.

Additional information ℹ️

All three repository regression cases record TargetException. Leaf numeric conversion, reference-cast and interface-cast controls pass. This is distinct from the runtime INPC discovery limitation in #1156.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions